EscolaLMS/Front

View on GitHub

Showing 559 of 559 total issues

Function CourseMainInfo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

export const CourseMainInfo: FC<CourseMainInfoProps> = ({ courseData }) => {
  const { fetchQuestionnaireStarsByModel } = useContext(EscolaLMSContext);
  const [state, setState] = useState<State>({ type: StateTypes.INIT });
  const history = useHistory();

Severity: Minor
Found in src/pages/courses/course/Components/CourseMainInfo/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

Function MyConsultationsPage has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MyConsultationsPage = () => {
  const { t } = useTranslation();
  const { isTutor } = useRoles();

  const myConsultationsTabs = useMemo(
Severity: Major
Found in src/pages/user/my-consultations.tsx - About 2 hrs to fix

    Function VerifyEmail has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const VerifyEmail: React.FC = () => {
      const { push } = useHistory();
      const { search } = useLocation();
      const id = search && search?.split("&")[0]?.split("=")[1];
      const hash = search && search?.split("&")[1]?.split("=")[1];
    Severity: Major
    Found in src/pages/verify-email/index.tsx - About 2 hrs to fix

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

      export const IconEyeOff = () => (
        <svg
          width="21"
          height="19"
          viewBox="0 0 21 19"
      Severity: Major
      Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
      src/icons/index.tsx on lines 1064..1081

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

      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 IconEye = () => (
        <svg
          width="21"
          height="15"
          viewBox="0 0 21 15"
      Severity: Major
      Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
      src/icons/index.tsx on lines 1083..1100

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

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

        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

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

          import React, {
            useCallback,
            useContext,
            useEffect,
            useMemo,
          Severity: Minor
          Found in src/components/Courses/Course/Context/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

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

                    {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

                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

              Severity
              Category
              Status
              Source
              Language