EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

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

            {paginatedProgress.loading || myAuthoredCourses.loading
              ? Array.from({ length: 8 }).map((_, index) => (
                  <Col md={3} key={`skeleton-card-${index}`}>
                    <CourseCardSkeleton />
                  </Col>
Severity: Major
Found in src/components/Profile/ProfileCourses/index.tsx and 1 other location - About 1 hr to fix
src/components/Profile/ProfileConsultations/index.tsx on lines 59..77

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

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

    ({
      questionnaireId,
      questionType,
    }: {
      questionnaireId: number | null;
Severity: Major
Found in src/hooks/questionnaires/index.tsx and 1 other location - About 1 hr to fix
src/utils/questionnaires.ts on lines 118..131

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

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 getCourseQuestionnaireReviewQuestion = ({
  questionnaires,
  questionnaireId,
  questionType,
}: {
Severity: Major
Found in src/utils/questionnaires.ts and 1 other location - About 1 hr to fix
src/hooks/questionnaires/index.tsx on lines 101..112

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

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

export const useCourseProgress = (courseId: number) => {
  const [progress, setProgress] = useState<PogressState>({
    data: undefined,
    loaded: false,
    loading: false,
Severity: Minor
Found in src/hooks/courses/useCourseProgress.ts - About 1 hr to fix

    Function useQuestionnaires has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export const useQuestionnaires = ({
      entityId,
      entityModel,
    }: UseQuestionnairesProps) => {
      const { fetchQuestionnaires, fetchQuestionnaire } =
    Severity: Minor
    Found in src/hooks/questionnaires/index.tsx - About 1 hr 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 EventDetailsSidebar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    const EventDetailsSidebar: React.FC<{ event: API.StationaryEvent }> = ({
      event,
    }) => {
      const [buttonStatus, setButtonStatus] = useState<ButtonStatus>(
        ButtonStatus.DEFAULT
    Severity: Minor
    Found in src/components/Events/Event/EventDetailsSidebar/index.tsx - About 1 hr 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

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

            <div className="search-container">
              <SearchCourses
                onItemSelected={(item) => history.push(`/courses/${item.id}`)}
                onInputSubmitted={(input) =>
                  history.push(`/courses/?title=${input}`)
    Severity: Major
    Found in src/components/_App/Navbar/index.tsx and 1 other location - About 1 hr to fix
    src/components/_App/Navbar/index.tsx on lines 445..452

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

    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

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

            <SearchMobileWrapper>
              <SearchCourses
                onItemSelected={(item) => history.push(`/courses/${item.id}`)}
                onInputSubmitted={(input) =>
                  history.push(`/courses/?title=${input}`)
    Severity: Major
    Found in src/components/_App/Navbar/index.tsx and 1 other location - About 1 hr to fix
    src/components/_App/Navbar/index.tsx on lines 558..565

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

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

    const EventsContainerItems = () => {
      const { params, setParams, events } = useContext(EventsContext);
      const eventLoading = events?.loading;
      const eventsMeta = events?.list?.meta;
      const theme = useTheme();
    Severity: Minor
    Found in src/components/Events/List/EventsContainer/Items/index.tsx - About 1 hr to fix

      Function WebinarsContainerItems has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const WebinarsContainerItems = () => {
        const { params, setParams, webinars } = useContext(WebinarsContext);
        const loading = webinars?.loading;
        const meta = webinars?.list?.meta;
        const theme = useTheme();
      Severity: Minor
      Found in src/components/Webinars/List/WebinarsContainer/Items/index.tsx - About 1 hr to fix

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

        export const NoDataStyles = styled.div`
          display: flex;
          justify-content: center;
          align-items: center;
          flex-direction: column;
        src/components/Profile/NoData/styles.tsx on lines 4..19

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

        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

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

        export const NoDataStyles = styled.div`
          display: flex;
          justify-content: center;
          align-items: center;
          flex-direction: column;
        Severity: Major
        Found in src/components/Profile/NoData/styles.tsx and 1 other location - About 1 hr to fix
        src/components/Profile/ProfileStationaryEvents/NoData/NoDataStyles.ts on lines 4..19

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

        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

              tutorConsultations.list?.data.filter((consultation) =>
                type === ConsultationStatus.STARTED ||
                type === ConsultationStatus.UPCOMING
                  ? consultation.in_coming || consultation.is_started
                  : consultation.is_ended
        Severity: Major
        Found in src/components/Profile/ProfileTutorConsultations/index.tsx and 1 other location - About 1 hr to fix
        src/components/Profile/ProfileConsultations/index.tsx on lines 27..32

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

        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
                    mode={"secondary outline"}
                    onClick={() => {
                      handleSortChange("ASC");
                      setMobileDrawerState({
        Severity: Major
        Found in src/components/Courses/CoursesCollection/coursesDrawer.tsx and 1 other location - About 1 hr to fix
        src/components/Courses/CoursesCollection/coursesDrawer.tsx on lines 68..79

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

        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

                <g id="Group_9" data-name="Group 9" transform="translate(-0.5 -0.5)">
                  <path
                    id="Path_16"
                    data-name="Path 16"
                    d="M117.86,4.89,122.646.117a.4.4,0,1,1,.566.568l-4.5,4.489,4.5,4.488a.4.4,0,0,1-.567.568L117.86,5.458a.4.4,0,0,1,0-.568Z"
        Severity: Major
        Found in src/icons/index.tsx and 1 other location - About 1 hr to fix
        src/icons/index.tsx on lines 258..279

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

        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

              userConsultations.list?.data.filter((consultation) =>
                type === ConsultationStatus.STARTED ||
                type === ConsultationStatus.UPCOMING
                  ? consultation.in_coming || consultation.is_started
                  : consultation.is_ended
        Severity: Major
        Found in src/components/Profile/ProfileConsultations/index.tsx and 1 other location - About 1 hr to fix
        src/components/Profile/ProfileTutorConsultations/index.tsx on lines 23..28

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

        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
                    mode={"secondary outline"}
                    onClick={() => {
                      handleSortChange("DESC");
                      setMobileDrawerState({
        Severity: Major
        Found in src/components/Courses/CoursesCollection/coursesDrawer.tsx and 1 other location - About 1 hr to fix
        src/components/Courses/CoursesCollection/coursesDrawer.tsx on lines 80..91

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

        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

            <svg
              width="18"
              height="18"
              viewBox="0 0 18 18"
              fill="none"
        Severity: Major
        Found in src/icons/index.tsx and 1 other location - About 1 hr to fix
        src/icons/index.tsx on lines 441..456

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

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

        export const useFirebase = () => {
          const { token } = useContext(EscolaLMSContext);
        
          const requestPermissions = async () => {
            const result = await FirebaseMessaging.requestPermissions();
        Severity: Minor
        Found in src/hooks/useFirebase.ts - About 1 hr to fix

          Function PackagesContainerItems has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const PackagesContainerItems = () => {
            const { params, setParams, packages } = useContext(PackagesContext);
            const packagesLoading = packages?.loading;
            const packagesMeta = packages?.list?.meta;
            const theme = useTheme();
          Severity: Minor
          Found in src/components/Packages/List/PackagesContainer/Items/index.tsx - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language