EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

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

      {buttonStatus === ButtonStatus.USER_BOUGHT_AND_WEBINAR_FINISHED && (
        <Button
          onClick={() => push(`/webinar/${webinarObj?.id}`)}
          mode="secondary"
        >
src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx on lines 136..143

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

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

      {buttonStatus === ButtonStatus.DEFAULT && (
        <Button
          onClick={() => push(`/login?referrer=/webinar/${webinarObj?.id}`)}
          mode="secondary"
        >
src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx on lines 100..107

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

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

      {buttonStatus === ButtonStatus.USER_BOUGHT_AND_EVENT_FINISHED && (
        <Button onClick={() => push(`/event/${event.id}`)} mode="secondary">
          {t("Show")}
        </Button>
      )}
Severity: Major
Found in src/components/Events/Event/EventDetailsSidebar/index.tsx and 1 other location - About 1 hr to fix
src/components/Events/Event/EventDetailsSidebar/index.tsx on lines 108..115

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

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 {
    processing,
    setProcessing,
    discountStatus,
    fetchCart,
Severity: Major
Found in src/components/Cart/CartContent/stripe.tsx and 1 other location - About 1 hr to fix
src/components/Courses/Course/CoursePanelLayout/ButtonsNav/index.tsx on lines 8..20

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

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

    case EventTypes.PaymentSuccess:
      return {
        translation,
        object: {
          amount: getPriceWithTax(notification.data.payment?.amount ?? 0) || 0,
Severity: Major
Found in src/utils/index.ts and 1 other location - About 1 hr to fix
src/utils/index.ts on lines 119..126

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

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

      {buttonStatus === ButtonStatus.DEFAULT && (
        <Button
          onClick={() => push(`/login?referrer=/event/${event.id}`)}
          mode="secondary"
        >
Severity: Major
Found in src/components/Events/Event/EventDetailsSidebar/index.tsx and 1 other location - About 1 hr to fix
src/components/Events/Event/EventDetailsSidebar/index.tsx on lines 84..88

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

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

export const CourseSchedule = () => {
  const { t } = useTranslation();
  const { user } = useContext(EscolaLMSContext);
  const {
    currentTopic,
Severity: Minor
Found in src/components/Courses/Course/CoursePanelLayout/Schedule/index.tsx - About 1 hr to fix

    Function SubscriptionsPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function MyStationaryEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const MyStationaryEvents = () => {
        const { fetchUserStationaryEvents } = useContext(EscolaLMSContext);
        const { t } = useTranslation();
        useEffect(() => {
          fetchUserStationaryEvents();
      Severity: Minor
      Found in src/pages/user/MyStationaryEvents/index.tsx - About 1 hr to fix

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

          const paginationMeta = useMemo(
            () =>
              filter === CourseStatus.AUTHORED
                ? myAuthoredCourses.list?.meta
                : paginatedProgress.list?.meta,
        Severity: Major
        Found in src/components/Profile/ProfileCourses/index.tsx and 1 other location - About 1 hr to fix
        src/hooks/courses/useProfileCourses.ts on lines 29..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 65.

        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

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

          const paginationMeta = useMemo(
            () =>
              filter === CourseStatus.AUTHORED
                ? myAuthoredCourses.list?.meta
                : paginatedProgress.list?.meta,
        Severity: Major
        Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 1 hr to fix
        src/components/Profile/ProfileCourses/index.tsx on lines 86..92

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

        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

              {isEnded && consultation.date && (
                <DateInfo
                  type={DateInfoTypes.ENDED}
                  date={addTimeToDate(
                    consultation.date,
        src/components/Consultations/ConsultationCard/Content/index.tsx on lines 24..32

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

        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

              {isEnded && consultation.executed_at && (
                <DateInfo
                  type={DateInfoTypes.ENDED}
                  date={addTimeToDate(
                    consultation.executed_at,
        src/components/Consultations/ConsultationTutorCard/Content/DateInfo/index.tsx on lines 31..39

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

        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 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 1 hr to fix
        src/components/Courses/Course/CourseSidebar/index.tsx on lines 115..119

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

        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

            "AdditionalFields.Privacy Policy": (
              <Text size="14">
                {t("AcceptCheckbox")}{" "}
                <StyledLink to={routeRoutes.privacyPolicy}>
                  {t("PrivacyPolicy")}
        Severity: Major
        Found in src/pages/register/index.tsx and 1 other location - About 1 hr to fix
        src/pages/register/index.tsx on lines 138..145

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

        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

            "AdditionalFields.Terms of Service": (
              <Text size="14">
                {t("AcceptCheckbox")}{" "}
                <StyledLink to={routeRoutes.privacyPolicy}>
                  {t("TermsOfService")}
        Severity: Major
        Found in src/pages/register/index.tsx and 1 other location - About 1 hr to fix
        src/pages/register/index.tsx on lines 130..137

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

        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 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 1 hr to fix
        src/components/Courses/Course/Context/index.tsx on lines 175..179

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

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

          const Buttons = useMemo(() => {
            if (userId && product.owned) {
              return <Text size="12">{t("PackagePage.ProductOwned")}</Text>;
            }
            if (productInCart) {
        Severity: Minor
        Found in src/components/Packages/Package/PackageSidebar/Buttons/index.tsx - About 1 hr to fix

          Function availableTopicsIds has 36 lines of code (exceeds 25 allowed). 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: Minor
          Found in src/components/Courses/Course/CourseSidebar/index.tsx - About 1 hr to fix

            Function availableTopicsIds has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const availableTopicsIds = useMemo(() => {
                const { in_progress, complete } = activeLessonsFlatTopics.reduce<{
                  in_progress: number[];
                  complete: number[];
                  incomplete: number[];
            Severity: Minor
            Found in src/components/Courses/Course/Context/index.tsx - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language