EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

Function handleSubmit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const handleSubmit = (): void => {
    if (!billingDetails.name) {
      toast(`${t("Cart.EmptyNameWarning")}`, "error");
      return;
    }
Severity: Minor
Found in src/components/Cart/CartContent/stripe.tsx - About 1 hr to fix

    Function PackageSidebarTags has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const PackageSidebarTags = () => {
      const { product } = useContext(EscolaLMSContext);
      const grouped = useMemo(
        () => groupProductablesByType(product?.value?.productables || []),
        [product?.value?.productables]
    Severity: Minor
    Found in src/components/Packages/Package/PackageSidebar/Tags/index.tsx - About 1 hr to fix

      Function CartPage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const CartPage: React.FC<Props> = () => {
        const { config } = useContext(EscolaLMSContext);
        const stripePromise = (publishable_key: string) =>
          loadStripe(publishable_key);
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
      Severity: Minor
      Found in src/pages/cart/index.tsx - About 1 hr to fix

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

            {
              title: (
                <Link to={routeRoutes.courses}>
                  <Text noMargin bold>
                    {t("Menu.Consultations")}
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx and 3 other locations - About 1 hr to fix
        src/components/_App/Navbar/index.tsx on lines 290..299
        src/components/_App/Navbar/index.tsx on lines 300..309
        src/components/_App/Navbar/index.tsx on lines 320..329

        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 61.

        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 4 locations. Consider refactoring.
        Open

              CoursesPage: {
                Category: "Kategoria",
                Free: "Darmowe",
                All: "Wszystkie",
                Type: "Typ szkolenia",
        Severity: Major
        Found in src/i18n.ts and 3 other locations - About 1 hr to fix
        src/i18n.ts on lines 267..279
        src/i18n.ts on lines 660..672
        src/i18n.ts on lines 1403..1415

        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 61.

        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 4 locations. Consider refactoring.
        Open

              InvoiceData: {
                BillingDetails: "Billing details",
                InvoiceData: "Invoice Data",
                ClientTaxId: "Tax Identification Number",
                ClientCompanyName: "Company Name",
        Severity: Major
        Found in src/i18n.ts and 3 other locations - About 1 hr to fix
        src/i18n.ts on lines 267..279
        src/i18n.ts on lines 970..982
        src/i18n.ts on lines 1403..1415

        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 61.

        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 4 locations. Consider refactoring.
        Open

            {
              title: (
                <Link to={routeRoutes.home}>
                  <Text noMargin bold>
                    {t("Menu.HomePage")}
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx and 3 other locations - About 1 hr to fix
        src/components/_App/Navbar/index.tsx on lines 300..309
        src/components/_App/Navbar/index.tsx on lines 310..319
        src/components/_App/Navbar/index.tsx on lines 320..329

        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 61.

        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 4 locations. Consider refactoring.
        Open

            {
              title: (
                <Link to={routeRoutes.courses}>
                  <Text noMargin bold>
                    {t("Menu.Courses")}
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx and 3 other locations - About 1 hr to fix
        src/components/_App/Navbar/index.tsx on lines 290..299
        src/components/_App/Navbar/index.tsx on lines 310..319
        src/components/_App/Navbar/index.tsx on lines 320..329

        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 61.

        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

        export const CoursePanelHeaderContainer = styled.div`
          display: flex;
          align-items: center;
          gap: 12px;
          cursor: pointer;
        src/components/Courses/Course/CoursePanelLayout/Subheader/styles.tsx on lines 41..59

        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 61.

        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 4 locations. Consider refactoring.
        Open

              InvoiceData: {
                BillingDetails: "Dane do rachunku",
                InvoiceData: "Dane do faktury",
                ClientTaxId: "NIP",
                ClientCompanyName: "Nazwa firmy",
        Severity: Major
        Found in src/i18n.ts and 3 other locations - About 1 hr to fix
        src/i18n.ts on lines 267..279
        src/i18n.ts on lines 660..672
        src/i18n.ts on lines 970..982

        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 61.

        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

          return {
            topic,
            lesson,
            onNextTopic,
            onPrevTopic,
        Severity: Major
        Found in src/hooks/useLessonProgram.ts and 1 other location - About 1 hr to fix
        src/components/Cart/CartContent/p24.tsx on lines 27..40

        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 61.

        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 4 locations. Consider refactoring.
        Open

            {
              title: (
                <Link to={routeRoutes.subscriptions}>
                  <Text noMargin bold>
                    {t("MyProfilePage.Subscriptions")}
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx and 3 other locations - About 1 hr to fix
        src/components/_App/Navbar/index.tsx on lines 290..299
        src/components/_App/Navbar/index.tsx on lines 300..309
        src/components/_App/Navbar/index.tsx on lines 310..319

        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 61.

        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 4 locations. Consider refactoring.
        Open

              CoursesPage: {
                Category: "Category",
                Free: "Free",
                All: "All",
                Type: "Type",
        Severity: Major
        Found in src/i18n.ts and 3 other locations - About 1 hr to fix
        src/i18n.ts on lines 660..672
        src/i18n.ts on lines 970..982
        src/i18n.ts on lines 1403..1415

        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 61.

        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

        export const ProgressBarContainer = styled.div`
          width: calc(100% - 50px);
        
          .label-container .percentage-value {
            color: ${({ theme: { positive } }) => positive};
        src/components/Courses/Course/CoursePanelLayout/Header/styles.ts on lines 49..74

        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 61.

        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

              {
                id: 1,
                content: (
                  <IconText
                    icon={<IconSuccess />}
        src/components/Consultations/ConsultationTutorCard/Actions/index.tsx on lines 34..45

        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 61.

        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 {
            user,
            processing,
            discountStatus,
            fetchCart,
        Severity: Major
        Found in src/components/Cart/CartContent/p24.tsx and 1 other location - About 1 hr to fix
        src/hooks/useLessonProgram.ts on lines 115..128

        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 61.

        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

              {
                id: 2,
                content: (
                  <IconText
                    icon={<IconCircleError />}
        src/components/Consultations/ConsultationTutorCard/Actions/index.tsx on lines 22..33

        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 61.

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

        const MySubscriptions = () => {
          const { t } = useTranslation();
          const {
            subscriptions,
            getActiveSubscription,
        Severity: Minor
        Found in src/pages/user/my-subscriptions.tsx - About 1 hr to fix

          Function TutorPage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          const TutorPage = () => {
            const { id } = useParams<{ id: string }>();
            const { t } = useTranslation();
            const { tutor, fetchTutor, courses, fetchCourses } =
              useContext(EscolaLMSContext);
          Severity: Minor
          Found in src/pages/tutors/tutor/index.tsx - About 1 hr 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 useSubscriptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          const useSubscriptions = () => {
            const {
              fetchProducts,
              fetchMyProducts,
              products,
          Severity: Minor
          Found in src/hooks/useSubscriptions.ts - About 1 hr 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