EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

Function EventsHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventsHeaderFilters = () => {
  const { params, setParams } = useContext(EventsContext);
  const location = useLocation();
  const parsedParams = qs.parse(location.search, {
    arrayFormat: "bracket",
Severity: Major
Found in src/components/Events/List/EventsHeader/Filters/index.tsx - About 2 hrs to fix

    Function PackagesHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const PackagesHeaderFilters = () => {
      const { params, setParams } = useContext(PackagesContext);
      const location = useLocation();
      const parsedParams = qs.parse(location.search, {
        arrayFormat: "bracket",
    Severity: Major
    Found in src/components/Packages/List/PackagesHeader/Filters/index.tsx - About 2 hrs to fix

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

                      {topic && topic.introduction && (
                        <Col sm={12} md={12} lg={12}>
                          <div className="container-md">
                            <MarkdownRenderer>{topic.introduction}</MarkdownRenderer>
                          </div>
      src/components/Courses/Course/CourseProgramLessonsPreview.tsx on lines 50..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 84.

      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

                      {lesson && lesson.summary && (
                        <Col sm={12} md={12} lg={12}>
                          <div className="course-program-summary">
                            <MarkdownRenderer>{lesson.summary}</MarkdownRenderer>
                          </div>
      src/components/Courses/Course/CourseProgramLessonsPreview.tsx on lines 32..38

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

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

      const WebinarsHeaderFilters = () => {
        const { params, setParams } = useContext(WebinarsContext);
        const location = useLocation();
        const parsedParams = qs.parse(location.search, {
          arrayFormat: "bracket",
      Severity: Major
      Found in src/components/Webinars/List/WebinarsHeader/Filters/index.tsx - About 2 hrs to fix

        Function CoursesDetailsSidebar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        const CoursesDetailsSidebar: React.FC<Props> = ({
          course,
          onRequestAccess,
        }) => {
          const { user, courseAccess } = useContext(EscolaLMSContext);

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

        const Przelewy24Content = () => {
          const {
            user,
            processing,
            discountStatus,
        Severity: Minor
        Found in src/components/Cart/CartContent/p24.tsx - About 2 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 UserSelectDatePicker has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        const UserSelectDatePicker = ({ consultation, onClose }: Props) => {
          const [selectedDate, setSelectedDay] = useState<Date | null>(new Date());
          const { bookConsultationTerm, changeConsultationTerm } =
            useContext(EscolaLMSContext);
          const [loading, setLoading] = useState(false);
        Severity: Minor
        Found in src/components/Book/BookTermModal/UserSelectDatePicker/index.tsx - About 2 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 4 locations. Consider refactoring.
        Open

        export const ThankYouIcon = () => {
          return (
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="79"
        Severity: Major
        Found in src/icons/index.tsx and 3 other locations - About 2 hrs to fix
        src/icons/index.tsx on lines 201..218
        src/icons/index.tsx on lines 220..237
        src/icons/index.tsx on lines 798..815

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

        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 IconRate = () => {
          return (
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="14.002"
        Severity: Major
        Found in src/icons/index.tsx and 3 other locations - About 2 hrs to fix
        src/icons/index.tsx on lines 149..166
        src/icons/index.tsx on lines 220..237
        src/icons/index.tsx on lines 798..815

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

        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 IconCertificate = () => {
          return (
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="14.002"
        Severity: Major
        Found in src/icons/index.tsx and 3 other locations - About 2 hrs to fix
        src/icons/index.tsx on lines 149..166
        src/icons/index.tsx on lines 201..218
        src/icons/index.tsx on lines 798..815

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

        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

              {loading && (
                <SwiperSlider slidesPerView={slidesPerView}>
                  {Array.from({ length: 6 }).map((_, index) => (
                    <SwiperSlide key={index}>
                      <CourseCardSkeleton />
        Severity: Major
        Found in src/components/Courses/DisplayCoursesSlider/index.tsx and 1 other location - About 2 hrs to fix
        src/components/Courses/CoursesUserSlider/index.tsx on lines 43..51

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

        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 PdfIcon = () => {
          return (
            <svg
              xmlns="http://www.w3.org/2000/svg"
              width="13.757"
        Severity: Major
        Found in src/icons/index.tsx and 3 other locations - About 2 hrs to fix
        src/icons/index.tsx on lines 149..166
        src/icons/index.tsx on lines 201..218
        src/icons/index.tsx on lines 220..237

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

        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

              {loading && (
                <SwiperSlider slidesPerView={slidesPerView}>
                  {Array.from({ length: 6 }).map((_, index) => (
                    <SwiperSlide key={index}>
                      <CourseCardSkeleton />
        Severity: Major
        Found in src/components/Courses/CoursesUserSlider/index.tsx and 1 other location - About 2 hrs to fix
        src/components/Courses/DisplayCoursesSlider/index.tsx on lines 54..62

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

        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

                  <Button
                    loading={cart.loading}
                    mode="secondary"
                    onClick={() =>
                      addToCart(Number(consultation.product?.id)).then(() =>
        src/components/Events/Event/EventDetailsSidebar/index.tsx on lines 93..103

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

        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 fetchSubscriptions = useCallback(async () => {
            try {
              await fetchProducts({
                type: "subscription-all-in",
                pageSize: 500,
        Severity: Major
        Found in src/hooks/useSubscriptions.ts and 1 other location - About 2 hrs to fix
        src/hooks/useSubscriptions.ts on lines 33..43

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

        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

                <Button
                  loading={cart.loading}
                  mode="secondary"
                  onClick={() =>
                    addToCart(Number(event.product?.id)).then(() =>
        Severity: Major
        Found in src/components/Events/Event/EventDetailsSidebar/index.tsx and 1 other location - About 2 hrs to fix
        src/components/Consultations/Consultation/ConsultationSidebar.tsx on lines 137..147

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

        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 fetchMySubscriptions = useCallback(async () => {
            try {
              await fetchMyProducts({
                type: "subscription-all-in",
                pageSize: 500,
        Severity: Major
        Found in src/hooks/useSubscriptions.ts and 1 other location - About 2 hrs to fix
        src/hooks/useSubscriptions.ts on lines 21..31

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

        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

        File index.tsx has 262 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { EscolaLMSContext } from "@escolalms/sdk/lib/react";
        import {
          useCallback,
          useContext,
          useEffect,
        Severity: Minor
        Found in src/components/Onboarding/index.tsx - About 2 hrs to fix

          Function CourseSidebar has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          }> = ({ course, topicId, onCompleteTopic, onCourseFinish }) => {
            const { progress } = useLessonProgram(course);
            const {
              courseProgressDetails,
              user,
          Severity: Minor
          Found in src/components/Courses/Course/CourseSidebar/index.tsx - About 2 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

          Severity
          Category
          Status
          Source
          Language