EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

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

const Orders = () => {
  const { orders, fetchOrders, fetchOrderInvoice } =
    useContext(EscolaLMSContext);

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

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

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

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

        const remapNormalCourses = useCallback(
          (courses: API.CourseProgressItem[]) => {
            return courses.map((course: API.CourseProgressItem) => {
              return {
                ...course.course,
      Severity: Major
      Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 4 hrs to fix
      src/components/Profile/ProfileCourses/index.tsx on lines 147..163

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

      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: {
              IWantInvoice: "Chcę otrzymać fakturę VAT z numerem NIP",
              UseTestCard: "Użyj testowej karty Stripe",
              LearnMore: "Sprawdź karty",
              Cart: "Koszyk",
      Severity: Major
      Found in src/i18n.ts and 1 other location - About 4 hrs to fix
      src/i18n.ts on lines 181..204

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

      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: {
              IWantInvoice: "I want to receive a VAT invoice with a VAT number",
              UseTestCard: "Use test cards for Stripe",
              LearnMore: "Learn more",
              Cart: "Cart",
      Severity: Major
      Found in src/i18n.ts and 1 other location - About 4 hrs to fix
      src/i18n.ts on lines 934..957

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

      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 remapNormalCourses = useCallback(
          (courses: API.CourseProgressItem[]) => {
            return courses.map((course: API.CourseProgressItem) => {
              return {
                ...course.course,
      Severity: Major
      Found in src/components/Profile/ProfileCourses/index.tsx and 1 other location - About 4 hrs to fix
      src/hooks/courses/useProfileCourses.ts on lines 91..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 116.

      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

        useEffect(() => {
          if (
            location.search &&
            location.search.split("?")[1] !== parseParams(params)
          ) {
      Severity: Major
      Found in src/components/Packages/List/PackagesProvider/index.tsx and 2 other locations - About 3 hrs to fix
      src/components/Events/List/EventsProvider.tsx on lines 47..59
      src/components/Webinars/List/WebinarsProvider.tsx on lines 45..57

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

      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

        useEffect(() => {
          if (
            location.search &&
            location.search.split("?")[1] !== parseParams(params)
          ) {
      Severity: Major
      Found in src/components/Webinars/List/WebinarsProvider.tsx and 2 other locations - About 3 hrs to fix
      src/components/Events/List/EventsProvider.tsx on lines 47..59
      src/components/Packages/List/PackagesProvider/index.tsx on lines 44..56

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

      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

        useEffect(() => {
          if (
            location.search &&
            location.search.split("?")[1] !== parseParams(params)
          ) {
      Severity: Major
      Found in src/components/Events/List/EventsProvider.tsx and 2 other locations - About 3 hrs to fix
      src/components/Packages/List/PackagesProvider/index.tsx on lines 44..56
      src/components/Webinars/List/WebinarsProvider.tsx on lines 45..57

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

      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 WebinarsContainer = () => {
        const { categoryTree } = useContext(EscolaLMSContext);
      
        return (
          <>
      Severity: Major
      Found in src/components/Webinars/List/WebinarsContainer/index.tsx and 1 other location - About 3 hrs to fix
      src/components/Events/List/EventsContainer/index.tsx on lines 7..25

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

      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 EventsContainer = () => {
        const { categoryTree } = useContext(EscolaLMSContext);
      
        return (
          <>
      Severity: Major
      Found in src/components/Events/List/EventsContainer/index.tsx and 1 other location - About 3 hrs to fix
      src/components/Webinars/List/WebinarsContainer/index.tsx on lines 7..25

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

      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

                          discount={{
                            onDiscountClick: (discountValue) =>
                              realizeVoucher(discountValue)
                                .then((response) => {
                                  if (response.success) {
      Severity: Major
      Found in src/components/Cart/CartContent/stripe.tsx and 1 other location - About 3 hrs to fix
      src/components/Cart/CartContent/p24.tsx on lines 170..186

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

      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

                            discount={{
                              onDiscountClick: (discountValue) =>
                                realizeVoucher(discountValue)
                                  .then((response) => {
                                    if (response.success) {
      Severity: Major
      Found in src/components/Cart/CartContent/p24.tsx and 1 other location - About 3 hrs to fix
      src/components/Cart/CartContent/stripe.tsx on lines 196..212

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

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

      const CoursePanelProvider: React.FC<React.PropsWithChildren> = ({
        children,
      }) => {
        const {
          sendProgress,
      Severity: Minor
      Found in src/components/Courses/Course/Context/index.tsx - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function Routes has 93 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

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

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

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

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

                  image={
                    <Link to={`/webinar/${webinar.id}`} aria-label={webinar.name}>
                      {webinar.image_path ? (
                        <ResponsiveImage
                          path={webinar.image_path}
            src/components/Events/List/EventsContainer/Items/Item/index.tsx on lines 29..41
            src/components/Packages/List/PackagesContainer/Items/Item/index.tsx on lines 29..41

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

            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

                  image={
                    <Link to={`/package/${product.id}`} aria-label={product.name}>
                      {product.poster_path ? (
                        <ResponsiveImage
                          path={product.poster_path}
            src/components/Events/List/EventsContainer/Items/Item/index.tsx on lines 29..41
            src/components/Webinars/List/WebinarsContainer/Items/Item/index.tsx on lines 38..50

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

            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

                  image={
                    <Link to={`/event/${event.id}`} aria-label={event.name}>
                      {event.image_path ? (
                        <ResponsiveImage
                          path={event.image_path}
            src/components/Packages/List/PackagesContainer/Items/Item/index.tsx on lines 29..41
            src/components/Webinars/List/WebinarsContainer/Items/Item/index.tsx on lines 38..50

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

            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