EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

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

const WebinarsPage = () => {
  const { t } = useTranslation();
  return (
    <Layout metaTitle={t("WebinarsPage.Webinars")}>
      <WebinarsProvider>
Severity: Major
Found in src/pages/webinars/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/packages/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 ConsultationsPage = () => {
  const { t } = useTranslation();

  return (
    <Layout metaTitle={t("ConsultationsPageMeta")}>
Severity: Major
Found in src/pages/consultations/index.tsx and 3 other locations - About 3 hrs to fix
src/pages/events/index.tsx on lines 7..20
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 2 locations. Consider refactoring.
Open

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

Function Routes has 87 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 WebinarInfo has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const WebinarInfo = () => {
      const { webinar } = useContext(EscolaLMSContext);
      const { t } = useTranslation();
    
      if (!webinar.value) {
    Severity: Major
    Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx - About 3 hrs to fix

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

      const ConsultationSidebar: React.FC<ConsultationSidebarProps> = (props) => {
        const { consultation } = props;
        const { cart, addToCart, user } = useContext(EscolaLMSContext);
        const { t } = useTranslation();
        const { push } = useHistory();
      Severity: Minor
      Found in src/components/Consultations/Consultation/ConsultationSidebar.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 ProfileCourses has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      const ProfileCourses = ({
        filter = CourseStatus.ALL,
      }: {
        filter: CourseStatus;
      }) => {
      Severity: Minor
      Found in src/components/Profile/ProfileCourses/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

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

            if (Capacitor.getPlatform() === "ios") {
              await Purchases.configure({
                apiKey: VITE_APP_IOS_APIKEY,
                appUserID: `${id}`,
              });
      Severity: Major
      Found in src/components/Subscriptions/Box/index.tsx and 1 other location - About 3 hrs to fix
      src/components/Courses/SingleCoursesTwo/CoursesDetailsSidebar/Buttons/index.tsx on lines 58..68

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

      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

              if (Capacitor.getPlatform() === "ios") {
                await Purchases.configure({
                  apiKey: VITE_APP_IOS_APIKEY,
                  appUserID: `${id}`,
                });
      src/components/Subscriptions/Box/index.tsx on lines 115..125

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

      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

      export const IconSuccess = ({
        width = "25px",
        height = "25px",
        color = "#4A4A4A",
      }) => (
      Severity: Major
      Found in src/icons/index.tsx and 3 other locations - About 3 hrs to fix
      src/icons/index.tsx on lines 1121..1138
      src/icons/index.tsx on lines 1140..1157
      src/icons/index.tsx on lines 1159..1176

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

      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

      export const IconCalendar = ({
        width = "25px",
        height = "25px",
        color = "#4A4A4A",
      }) => (
      Severity: Major
      Found in src/icons/index.tsx and 3 other locations - About 3 hrs to fix
      src/icons/index.tsx on lines 1102..1119
      src/icons/index.tsx on lines 1140..1157
      src/icons/index.tsx on lines 1159..1176

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

      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

                {product.value.categories && product.value.categories.length > 0 && (
                  <div className="single-label">
                    <LabelListItem
                      title={t("CoursePage.CourseCategory")}
                      variant={"label"}
      Severity: Major
      Found in src/components/Packages/Package/PackageInfo/index.tsx and 2 other locations - About 3 hrs to fix
      src/components/Events/Event/EventInfo/index.tsx on lines 66..76
      src/components/Webinars/Webinar/WebinarInfo/index.tsx on lines 66..75

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

      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

      export const IconMenuVertical = ({
        width = "24px",
        height = "25px",
        color = "#4A4A4A",
      }) => (
      Severity: Major
      Found in src/icons/index.tsx and 3 other locations - About 3 hrs to fix
      src/icons/index.tsx on lines 1102..1119
      src/icons/index.tsx on lines 1121..1138
      src/icons/index.tsx on lines 1140..1157

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

      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

      export const IconCircleError = ({
        width = "25px",
        height = "25px",
        color = "#4A4A4A",
      }) => (
      Severity: Major
      Found in src/icons/index.tsx and 3 other locations - About 3 hrs to fix
      src/icons/index.tsx on lines 1102..1119
      src/icons/index.tsx on lines 1121..1138
      src/icons/index.tsx on lines 1159..1176

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

      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

                {webinar.value.tags && webinar.value.tags.length > 0 && (
                  <div className="single-label">
                    <LabelListItem
                      title={t("WebinarPage.WebinarTags")}
                      variant={"label"}
      Severity: Major
      Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx and 2 other locations - About 3 hrs to fix
      src/components/Events/Event/EventInfo/index.tsx on lines 66..76
      src/components/Packages/Package/PackageInfo/index.tsx on lines 65..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 102.

      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

                {stationaryEvent.value.categories &&
                  stationaryEvent.value.categories.length > 0 && (
                    <div className="single-label">
                      <LabelListItem
                        title={t("CoursePage.CourseCategory")}
      Severity: Major
      Found in src/components/Events/Event/EventInfo/index.tsx and 2 other locations - About 3 hrs to fix
      src/components/Packages/Package/PackageInfo/index.tsx on lines 65..74
      src/components/Webinars/Webinar/WebinarInfo/index.tsx on lines 66..75

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

      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 ConsultationCardBookButton = ({ showBookTerm }: Props) => {
        const { t } = useTranslation();
      
        const onClick = useCallback(() => {
          showBookTerm(true);
      src/components/Consultations/ConsultationCard/Buttons/ChangeButton/index.tsx on lines 9..21

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

      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 ConsultationCardChangeButton = ({ showBookTerm }: Props) => {
        const { t } = useTranslation();
      
        const onClick = useCallback(() => {
          showBookTerm(true);
      src/components/Consultations/ConsultationCard/Buttons/BookButton/index.tsx on lines 9..21

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

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

      const CoursesCollection: React.FC = () => {
        const [mobileDrawerState, setMobileDrawerState] = React.useState<{
          showDrawer: boolean;
          type: keyof typeof MobileDrawerTypes;
        }>({
      Severity: Major
      Found in src/components/Courses/CoursesCollection/index.tsx - About 3 hrs to fix
        Severity
        Category
        Status
        Source
        Language