EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

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

      ConsultationPage: {
        Book: "Book your consultation",
        SidebarHeader: "Online consultation with your expert",
        IsFinished: "The consultation is over",
        GoToCheckout: "Go to checkout",
Severity: Major
Found in src/i18n.ts and 1 other location - About 5 hrs to fix
src/i18n.ts on lines 987..1019

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

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

      ConsultationPage: {
        Book: "Umów spotkanie",
        SidebarHeader: "Konsultacja online z ekspertem",
        IsFinished: "Konsultacja się zakończyła",
        GoToCheckout: "Do kasy",
Severity: Major
Found in src/i18n.ts and 1 other location - About 5 hrs to fix
src/i18n.ts on lines 218..250

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

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

const RegisterPage = () => {
  const { search } = useLocation();
  const { user, socialAuthorize } = useContext(EscolaLMSContext);
  const [view, setView] = useState<"" | "success" | "register">("");
  const [modalVisible, setModalVisible] = useState(false);
Severity: Major
Found in src/pages/register/index.tsx - About 5 hrs to fix

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

      const taskCreateBy = [
        {
          id: 0,
          content: (
            <IconText
    Severity: Major
    Found in src/pages/user/MyTasks/index.tsx and 1 other location - About 5 hrs to fix
    src/pages/user/MyTasks/index.tsx on lines 51..76

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

    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 sortType = [
        {
          id: 0,
          content: (
            <IconText
    Severity: Major
    Found in src/pages/user/MyTasks/index.tsx and 1 other location - About 5 hrs to fix
    src/pages/user/MyTasks/index.tsx on lines 78..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 146.

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

    export const QuestionnairesModal = ({
      entityId,
      entityModel,
      onSuccesGetQuestionnaires,
    }: Props) => {

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

    const Footer = () => {
      const { settings, fetchPages, pages, user } = useContext(EscolaLMSContext);
      const { t, i18n } = useTranslation();
      useEffect(() => {
        fetchPages();
    Severity: Major
    Found in src/components/_App/Footer/index.tsx - About 5 hrs to fix

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

            {consultation.loading && (
              <>
                <StyledCoursePage>
                  <Container>
                    <Row>
      Severity: Major
      Found in src/components/Consultations/Consultation/index.tsx and 1 other location - About 5 hrs to fix
      src/pages/courses/course/index.tsx on lines 101..116

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

      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

            {course.loading && (
              <>
                <StyledCoursePage>
                  <Container>
                    <Row>
      Severity: Major
      Found in src/pages/courses/course/index.tsx and 1 other location - About 5 hrs to fix
      src/components/Consultations/Consultation/index.tsx on lines 52..67

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

      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.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        BulkNotificationSection,
        EventTypes,
        Notification,
        Order,
      Severity: Minor
      Found in src/utils/index.ts - About 4 hrs to fix

        Function WebinarSidebarButtons has 118 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const WebinarSidebarButtons = () => {
          const [buttonStatus, setButtonStatus] = useState<ButtonStatus>(
            ButtonStatus.DEFAULT
          );
          const [showMeetModal, setShowMeetModal] = useState(false);
        Severity: Major
        Found in src/components/Webinars/Webinar/WebinarSidebar/Buttons/index.tsx - About 4 hrs to fix

          Function usePayment has 117 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const usePayment = () => {
            const {
              user,
              cart,
              fetchCart,
          Severity: Major
          Found in src/hooks/usePayment.ts - About 4 hrs to fix

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

              useEffect(() => {
                filter !== CourseStatus.AUTHORED
                  ? setCoursesToMap(remapNormalCourses(paginatedProgress.list?.data || []))
                  : filter === CourseStatus.AUTHORED
                  ? setCoursesToMap(myAuthoredCourses.list?.data || [])
            Severity: Major
            Found in src/components/Profile/ProfileCourses/index.tsx and 1 other location - About 4 hrs to fix
            src/hooks/courses/useProfileCourses.ts on lines 109..118

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

            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(() => {
                filter !== CourseStatus.AUTHORED
                  ? setCoursesToMap(remapNormalCourses(paginatedProgress.list?.data || []))
                  : filter === CourseStatus.AUTHORED
                  ? setCoursesToMap(myAuthoredCourses.list?.data || [])
            Severity: Major
            Found in src/hooks/courses/useProfileCourses.ts and 1 other location - About 4 hrs to fix
            src/components/Profile/ProfileCourses/index.tsx on lines 165..174

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

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

            const useFilter = (entityType: EntityType = "courses") => {
              const coursesContext = useContext(CoursesContext);
              const consultationsContext = useContext(ConsultationsContext);
              const { fetchCategories, categoryTree } = useContext(EscolaLMSContext);
            
            
            Severity: Major
            Found in src/hooks/courses/useFilter.ts - About 4 hrs to fix

              Function Navbar has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              const Navbar = () => {
                const { t } = useTranslation();
                const {
                  showModal,
                  closeModal,
              Severity: Minor
              Found in src/components/_App/Navbar/index.tsx - About 4 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 JitsyMeeting has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              const JitsyMeeting: React.FC<Props> = ({
                jitsyData,
                term,
                consultationTermId,
                consultationId,
              Severity: Minor
              Found in src/components/Consultations/ConsultationCard/JitsyMeeting/index.tsx - About 4 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 useChatLogic has 110 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const useChatLogic = (lessonID: number, token: string | null | undefined) => {
                if (!token) throw new Error("Token is required");
              
                const [chatState, setChatState] = useState<State>(INITIAL_STATE);
                const { t } = useTranslation();
              Severity: Major
              Found in src/hooks/chat/useChatLogic.ts - About 4 hrs to fix

                Function Tasks has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Tasks = () => {
                  const { t } = useTranslation();
                  const [currentPage, setCurrentPage] = useState(1);
                  const [lastPage, setLastPage] = useState(2);
                  const previousDisabled = currentPage <= 1;
                Severity: Major
                Found in src/pages/user/MyTasks/index.tsx - About 4 hrs to fix

                  Function useProfileCourses has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const useProfileCourses = (filter = CourseStatus.ALL) => {
                    const {
                      fetchMyAuthoredCourses,
                      myAuthoredCourses,
                      fetchPaginatedProgress,
                  Severity: Major
                  Found in src/hooks/courses/useProfileCourses.ts - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language