EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

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

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 929..953

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

Function useCoursesFilter has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useCoursesFilter = () => {
  const { courses, params, setParams, loading } = useContext(CoursesContext);
  const { fetchCategories, categoryTree } = useContext(EscolaLMSContext);
  const [prevCategories, setPrevCategories] = useState<Category[]>([]);
  const history = useHistory();
Severity: Major
Found in src/hooks/courses/useCoursesFIlter.ts - About 4 hrs to fix

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

    const EventsContainer = () => {
      const { categoryTree } = useContext(EscolaLMSContext);
    
      return (
        <>
    Severity: Major
    Found in src/components/Events/List/EventsContainer/index.tsx and 2 other locations - About 3 hrs to fix
    src/components/Consultations/List/ConsultationsContainer/index.tsx on lines 7..25
    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 3 locations. Consider refactoring.
    Open

    const ConsultationsContainer = () => {
      const { categoryTree } = useContext(EscolaLMSContext);
    
      return (
        <>
    src/components/Events/List/EventsContainer/index.tsx on lines 7..25
    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 3 locations. Consider refactoring.
    Open

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

                          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 195..211

    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/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

    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

      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

      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={`/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

      Function Navbar has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      const Navbar = () => {
        const { t } = useTranslation();
        const {
          showModal,
          closeModal,
      Severity: Minor
      Found in src/components/_App/Navbar/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 PromotedCoursesSection has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const PromotedCoursesSection: React.FC = () => {
        const { courses, loading } = useFetchCourses({
          per_page: 8,
        });
      
      
      Severity: Major
      Found in src/components/Courses/PromotedCoursesSection/index.tsx - About 3 hrs to fix

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

        const EventsPage = () => {
          const { t } = useTranslation();
          return (
            <Layout metaTitle={t("EventsPage.Events")}>
              <EventsProvider>
        Severity: Major
        Found in src/pages/events/index.tsx and 3 other locations - About 3 hrs to fix
        src/pages/consultations/index.tsx on lines 7..21
        src/pages/packages/index.tsx on lines 7..20
        src/pages/webinars/index.tsx on lines 7..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 105.

        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

        const PackagesPage = () => {
          const { t } = useTranslation();
          return (
            <Layout metaTitle={t("PackagesPage.Events")}>
              <PackagesProvider>
        Severity: Major
        Found in src/pages/packages/index.tsx and 3 other locations - About 3 hrs to fix
        src/pages/consultations/index.tsx on lines 7..21
        src/pages/events/index.tsx on lines 7..20
        src/pages/webinars/index.tsx on lines 7..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 105.

        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 (paginatedProgress.list?.data || []).reduce((acc, curr) => {
              return {
                ...acc,
                [curr.course.id ? curr.course.id : -1]: Math.round(
                  ((curr.progress || []).reduce(
        Severity: Major
        Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 3 hrs to fix
        src/components/Profile/ProfileCourses/index.tsx on lines 132..144

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

        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