EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

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

            avatar={{
              alt: `${user.first_name} ${user.last_name}`,
              src: `${API_URL}/api/images/img?path=${user.path_avatar}` || "",
            }}
Severity: Major
Found in src/components/TutorsSection/index.tsx and 1 other location - About 1 hr to fix
src/components/Events/Event/EventTutor/index.tsx on lines 29..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 62.

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

              avatar={{
                alt: `${author.first_name} ${author.last_name}`,
                src:
                  `${API_URL}/api/images/img?path=${author.path_avatar}` || "",
              }}
Severity: Major
Found in src/components/Events/Event/EventTutor/index.tsx and 1 other location - About 1 hr to fix
src/components/TutorsSection/index.tsx on lines 37..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 62.

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

Consider simplifying this complex logical expression.
Open

    if (
      slug &&
      !page.loading &&
      ((!page.value && !page.error) ||
        (page.value && page.value?.slug !== slug) ||
Severity: Critical
Found in src/pages/static-page/index.tsx - About 1 hr to fix

    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

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

          const App = () => {
            const { fetchSettings, settings, fetchNotifications, fetchConfig } =
              useContext(EscolaLMSContext);
          
            useEffect(() => {
          Severity: Minor
          Found in src/App.tsx - About 1 hr to fix

            Similar blocks of code found in 3 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 2 other locations - About 1 hr to fix
            src/components/_App/Navbar/index.tsx on lines 285..294
            src/components/_App/Navbar/index.tsx on lines 315..324

            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 655..667
            src/i18n.ts on lines 966..978
            src/i18n.ts on lines 1393..1405

            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 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 263..275
            src/i18n.ts on lines 655..667
            src/i18n.ts on lines 966..978

            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 3 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 2 other locations - About 1 hr to fix
            src/components/_App/Navbar/index.tsx on lines 295..304
            src/components/_App/Navbar/index.tsx on lines 315..324

            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 263..275
            src/i18n.ts on lines 655..667
            src/i18n.ts on lines 1393..1405

            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 3 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 2 other locations - About 1 hr to fix
            src/components/_App/Navbar/index.tsx on lines 285..294
            src/components/_App/Navbar/index.tsx on lines 295..304

            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 263..275
            src/i18n.ts on lines 966..978
            src/i18n.ts on lines 1393..1405

            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

            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

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

              const CourseDetailsSidebarButtons: React.FC<Props> = ({
                course,
                userOwnThisCourse,
                onRequestAccess,
              }) => {

              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