EscolaLMS/Front

View on GitHub

Showing 559 of 559 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 1454 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

      Similar blocks of code found in 2 locations. 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 and 1 other location - About 2 days to fix
      src/components/Packages/List/PackagesHeader/Filters/index.tsx on lines 11..76

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 422.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. 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 and 1 other location - About 2 days to fix
      src/components/Events/List/EventsHeader/Filters/index.tsx on lines 11..76

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 422.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        const availableTopicsIds = useMemo(() => {
          const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
            (l) =>
              l.active_from === null ||
              (l.active_from && isAfter(new Date(), new Date(l.active_from)))
      Severity: Major
      Found in src/components/Courses/Course/Context/index.tsx and 1 other location - About 2 days to fix
      src/components/Courses/Course/CourseSidebar/index.tsx on lines 114..157

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 390.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

        const availableTopicsIds = useMemo(() => {
          const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
            (l) =>
              l.active_from === null ||
              (l.active_from && isAfter(new Date(), new Date(l.active_from)))
      Severity: Major
      Found in src/components/Courses/Course/CourseSidebar/index.tsx and 1 other location - About 2 days to fix
      src/components/Courses/Course/Context/index.tsx on lines 173..216

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 390.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function Navbar has 438 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

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

                <Row>
                  <Col lg={7}>
                    <Title mobile={isMobile} level={2}>
                      {product.value.name}
                    </Title>
        Severity: Major
        Found in src/components/Packages/Package/PackageInfo/index.tsx and 2 other locations - About 2 days to fix
        src/components/Events/Event/EventInfo/index.tsx on lines 23..64
        src/components/Webinars/Webinar/WebinarInfo/index.tsx on lines 23..64

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 385.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                <Row>
                  <Col lg={7}>
                    <Title mobile={isMobile} level={2}>
                      {webinar.value.name}
                    </Title>
        Severity: Major
        Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx and 2 other locations - About 2 days to fix
        src/components/Events/Event/EventInfo/index.tsx on lines 23..64
        src/components/Packages/Package/PackageInfo/index.tsx on lines 22..63

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 385.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                <Row>
                  <Col lg={7}>
                    <Title mobile={isMobile} level={2}>
                      {stationaryEvent.value.name}
                    </Title>
        Severity: Major
        Found in src/components/Events/Event/EventInfo/index.tsx and 2 other locations - About 2 days to fix
        src/components/Packages/Package/PackageInfo/index.tsx on lines 22..63
        src/components/Webinars/Webinar/WebinarInfo/index.tsx on lines 23..64

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 385.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        const WebinarsContainerItems = () => {
          const { params, setParams, webinars } = useContext(WebinarsContext);
          const loading = webinars?.loading;
          const meta = webinars?.list?.meta;
          const theme = useTheme();
        Severity: Major
        Found in src/components/Webinars/List/WebinarsContainer/Items/index.tsx and 1 other location - About 2 days to fix
        src/components/Events/List/EventsContainer/Items/index.tsx on lines 9..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 382.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        const EventsContainerItems = () => {
          const { params, setParams, events } = useContext(EventsContext);
          const eventLoading = events?.loading;
          const eventsMeta = events?.list?.meta;
          const theme = useTheme();
        Severity: Major
        Found in src/components/Events/List/EventsContainer/Items/index.tsx and 1 other location - About 2 days to fix
        src/components/Webinars/List/WebinarsContainer/Items/index.tsx on lines 9..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 382.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        import { useContext, useEffect, 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

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

          const EventsHeaderStyles: FC<EventsHeaderStylesProps> = ({ children }) => {
            const StyledHeader = styled("div")<{ filters: API.EventsParams | undefined }>`
              background: ${({ theme }) => theme.primaryColor};
              padding: ${isMobile ? "60px 20px 20px 20px" : "140px 40px 30px"};
              margin-bottom: ${isMobile ? "100px" : "40px"};
          src/components/Webinars/List/WebinarsHeader/WebinarsHeaderStyles.tsx on lines 11..37

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 258.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

          const WebinarsHeaderStyles: FC<WebinarsHeaderStylesProps> = ({ children }) => {
            const StyledHeader = styled("div")<{
              filters: API.WebinarParams | undefined;
            }>`
              background: ${({ theme }) => theme.primaryColor};
          src/components/Events/List/EventsHeader/EventsHeaderStyles.tsx on lines 11..35

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 258.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

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

                      <div className="content-container">
                        <Title level={4} as="h2">
                          {t("CoursePage.RelatedCoursesTitle")}
                        </Title>
                        {data && data.length > 4 ? (
            Severity: Major
            Found in src/components/Events/Event/EventRelatedEvents/index.tsx and 1 other location - About 1 day to fix
            src/components/Events/Event/EventRelatedEvents/index.tsx on lines 49..77

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 243.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                      <div className="content-container">
                        <Title level={4} as="h2">
                          {t("CoursePage.InterestTitle")}
                        </Title>
                        {data && data.length > 4 ? (
            Severity: Major
            Found in src/components/Events/Event/EventRelatedEvents/index.tsx and 1 other location - About 1 day to fix
            src/components/Events/Event/EventRelatedEvents/index.tsx on lines 20..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 243.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                      {!(cart.value?.items.length === 0) ? (
                        <Row>
                          <Col lg={9}>
                            <Breadcrumbs
                              items={[
            Severity: Major
            Found in src/components/Cart/CartContent/stripe.tsx and 1 other location - About 1 day to fix
            src/components/Cart/CartContent/p24.tsx on lines 77..210

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 212.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                        {!(cart.value?.items.length === 0) ? (
                          <Row>
                            <Col lg={9}>
                              <div className="module-wrapper">
                                <Title style={{ marginBottom: 20 }} level={2} as="h3">
            Severity: Major
            Found in src/components/Cart/CartContent/p24.tsx and 1 other location - About 1 day to fix
            src/components/Cart/CartContent/stripe.tsx on lines 104..235

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 212.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language