EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

Function EventInfo has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventInfo = () => {
  const { stationaryEvent } = useContext(EscolaLMSContext);
  const { t } = useTranslation();

  if (!stationaryEvent.value) {
Severity: Major
Found in src/components/Events/Event/EventInfo/index.tsx - About 3 hrs to fix

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

                      image={
                        <Link to={`/courses/${course.id}`}>
                          {course.image_path ? (
                            <ResponsiveImage
                              path={course.image_path}
    Severity: Major
    Found in src/components/Courses/PromotedCoursesSection/index.tsx and 5 other locations - About 3 hrs to fix
    src/components/Courses/CoursesCollection/list.tsx on lines 55..67
    src/components/Courses/CoursesSlider/index.tsx on lines 48..60
    src/components/Courses/CoursesSlider/index.tsx on lines 105..117
    src/components/Courses/CoursesUserSlider/index.tsx on lines 65..77
    src/components/Profile/ProfileCourses/components/CourseCardItem/index.tsx on lines 34..46

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

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

                    image={
                      <Link to={`/courses/${item.id}`}>
                        {item.image_path ? (
                          <ResponsiveImage
                            path={item.image_path}
    Severity: Major
    Found in src/components/Courses/CoursesSlider/index.tsx and 5 other locations - About 3 hrs to fix
    src/components/Courses/CoursesCollection/list.tsx on lines 55..67
    src/components/Courses/CoursesSlider/index.tsx on lines 48..60
    src/components/Courses/CoursesUserSlider/index.tsx on lines 65..77
    src/components/Courses/PromotedCoursesSection/index.tsx on lines 125..137
    src/components/Profile/ProfileCourses/components/CourseCardItem/index.tsx on lines 34..46

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

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

                      image={
                        <Link to={`/courses/${item.id}`}>
                          {item.image_path ? (
                            <ResponsiveImage
                              path={item.image_path}
    Severity: Major
    Found in src/components/Courses/CoursesSlider/index.tsx and 5 other locations - About 3 hrs to fix
    src/components/Courses/CoursesCollection/list.tsx on lines 55..67
    src/components/Courses/CoursesSlider/index.tsx on lines 105..117
    src/components/Courses/CoursesUserSlider/index.tsx on lines 65..77
    src/components/Courses/PromotedCoursesSection/index.tsx on lines 125..137
    src/components/Profile/ProfileCourses/components/CourseCardItem/index.tsx on lines 34..46

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

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

                    image={
                      <Link to={`/courses/${item.id}`}>
                        {item.image_path ? (
                          <ResponsiveImage
                            path={item.image_path}
    Severity: Major
    Found in src/components/Courses/CoursesUserSlider/index.tsx and 5 other locations - About 3 hrs to fix
    src/components/Courses/CoursesCollection/list.tsx on lines 55..67
    src/components/Courses/CoursesSlider/index.tsx on lines 48..60
    src/components/Courses/CoursesSlider/index.tsx on lines 105..117
    src/components/Courses/PromotedCoursesSection/index.tsx on lines 125..137
    src/components/Profile/ProfileCourses/components/CourseCardItem/index.tsx on lines 34..46

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

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

            image={
              <Link to={`/course/${course.id}`}>
                {course.image_path ? (
                  <ResponsiveImage
                    path={course.image_path}
    src/components/Courses/CoursesCollection/list.tsx on lines 55..67
    src/components/Courses/CoursesSlider/index.tsx on lines 48..60
    src/components/Courses/CoursesSlider/index.tsx on lines 105..117
    src/components/Courses/CoursesUserSlider/index.tsx on lines 65..77
    src/components/Courses/PromotedCoursesSection/index.tsx on lines 125..137

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

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

                  image={
                    <Link to={`/courses/${item.id}`}>
                      {item.image_path ? (
                        <ResponsiveImage
                          path={item.image_path}
    Severity: Major
    Found in src/components/Courses/CoursesCollection/list.tsx and 5 other locations - About 3 hrs to fix
    src/components/Courses/CoursesSlider/index.tsx on lines 48..60
    src/components/Courses/CoursesSlider/index.tsx on lines 105..117
    src/components/Courses/CoursesUserSlider/index.tsx on lines 65..77
    src/components/Courses/PromotedCoursesSection/index.tsx on lines 125..137
    src/components/Profile/ProfileCourses/components/CourseCardItem/index.tsx on lines 34..46

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

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

    const Footer = () => {
      const { settings, fetchPages, pages, user } = useContext(EscolaLMSContext);
      const { t, i18n } = useTranslation();
      useEffect(() => {
        fetchPages();
    Severity: Minor
    Found in src/components/_App/Footer/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 CoursesCollection has 77 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

      Function useSearchParams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useSearchParams = () => {
        const { search, pathname } = useLocation();
        const history = useHistory();
      
        const query = useMemo(() => new URLSearchParams(search), [search]);
      Severity: Major
      Found in src/hooks/useSearchParams.ts - About 3 hrs to fix

        File index.tsx has 294 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 3 hrs to fix

          Function PackageInfo has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const PackageInfo = () => {
            const { product } = useContext(EscolaLMSContext);
            const { t } = useTranslation();
          
            if (!product.value) {
          Severity: Major
          Found in src/components/Packages/Package/PackageInfo/index.tsx - About 3 hrs to fix

            Function ConsultationsCollection has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ConsultationsCollection = () => {
              const { consultations, loading } = useContext(ConsultationsContext);
              const { t } = useTranslation();
            
              const consultationsCategories = consultations?.data?.map((item) =>
            Severity: Major
            Found in src/components/Consultations/List/ConsultationsCollection/index.tsx - About 3 hrs to fix

              Function ChatIcon has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const ChatIcon = () => {
                return (
                  <svg
                    xmlns="http://www.w3.org/2000/svg"
                    width="31.296"
              Severity: Major
              Found in src/icons/index.tsx - About 3 hrs to fix

                Function TutorsPage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const TutorsPage = () => {
                  const { tutors, fetchTutors } = useContext(EscolaLMSContext);
                
                  const { t } = useTranslation();
                  const theme = useTheme();
                Severity: Major
                Found in src/pages/tutors/index.tsx - About 2 hrs to fix

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

                    useEffect(() => {
                      fetchPaginatedProgress({
                        page: page ? parseInt(page) : 1,
                        per_page: 8,
                        status: getStatusName(Number(status)),
                  Severity: Major
                  Found in src/components/Profile/ProfileCourses/index.tsx and 1 other location - About 2 hrs to fix
                  src/hooks/courses/useProfileCourses.ts on lines 56..73

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

                  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

                    useEffect(() => {
                      fetchPaginatedProgress({
                        page: page ? parseInt(page) : 1,
                        per_page: 18,
                        status: getStatusName(Number(status)),
                  Severity: Major
                  Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 2 hrs to fix
                  src/components/Profile/ProfileCourses/index.tsx on lines 112..129

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

                  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 ErrorToastIcon = (props: SVGProps<SVGSVGElement>) => (
                    <svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="28"
                      height="27.999"
                  Severity: Major
                  Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
                  src/icons/index.tsx on lines 1905..1921

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

                  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 (
                      <Link to={`/consultations/${consultation.id}`}>
                        {consultation.image_path ? (
                          <ResponsiveImage
                            path={consultation.image_path}
                  src/components/Consultations/ConsultationTutorCard/Image/index.tsx on lines 12..24

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

                  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 SuccessToastIcon = (props: SVGProps<SVGSVGElement>) => (
                    <svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="28"
                      height="27.999"
                  Severity: Major
                  Found in src/icons/index.tsx and 1 other location - About 2 hrs to fix
                  src/icons/index.tsx on lines 1923..1939

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

                  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