EscolaLMS/Front

View on GitHub

Showing 585 of 585 total issues

Function Pagination has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ currentPage, total, perPage, onPage, pageNeighbours = 2 }) => {
  const lastPage = Math.ceil(total / perPage);

  const fetchPageNumbers = () => {
    /**
Severity: Minor
Found in src/components/Common/Pagination/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 useCamera has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const useCamera = () => {
  const [hasCameraAccess, setHasCameraAccess] = useState(false);
  const streamRef = useRef<MediaStream | null>(null);
  const videoRef = useRef<HTMLVideoElement | null>(null);

Severity: Minor
Found in src/hooks/meeting/useCamera.ts - 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 ProfileConsultations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ProfileConsultations = ({ type }: ProfileConsultationsProps) => {
  const { userConsultations, fetchUserConsultations } =
    useContext(EscolaLMSContext);
  const { t } = useTranslation();
  const [consultationsData, setConsultationsData] = useState<
Severity: Minor
Found in src/components/Profile/ProfileConsultations/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 CourseCardActions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const CourseCardActions: FC<Props> = ({
  courseData,
  courseProgress,
}) => {
  const [courseId, setCourseId] = useState<number | undefined>(undefined);
Severity: Minor
Found in src/components/Profile/ProfileCourses/CourseCardActions/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 ProfileTutorConsultations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ProfileTutorConsultations = ({
  type,
}: ProfileTutorConsultationsProps) => {
  const { tutorConsultations, fetchTutorConsultations } =
    useContext(EscolaLMSContext);
Severity: Minor
Found in src/components/Profile/ProfileTutorConsultations/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 CoursePanelFinishPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export const CoursePanelFinishPage = () => {
  const [state, setState] = useState<State>({
    showModal: false,
    isAnyQuestionnaire: null,
    showCertificate: false,

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

const EventAgenda = () => {
  const { stationaryEvent } = useContext(EscolaLMSContext);
  // TODO: fix this

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
Severity: Minor
Found in src/components/Events/Event/EventAgenda/index.tsx - About 1 hr to fix

    Function ArrowDown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ArrowDown = () => {
      return (
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="10.918"
    Severity: Minor
    Found in src/icons/index.tsx - About 1 hr to fix

      Function questionnairesWithCombinedQuestions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                response.data.map(async (data) => {
                  const questions = await getQuestionnaire(data.id);
      
                  const combinedQuestions = data.questions.reduce(
                    (result, element) => {
      Severity: Minor
      Found in src/hooks/questionnaires/index.tsx - About 1 hr to fix

        Function WebinarContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const WebinarContent = () => {
          const { webinar } = useContext(EscolaLMSContext);
          const { t } = useTranslation();
        
          return (
        Severity: Minor
        Found in src/components/Webinars/Webinar/index.tsx - About 1 hr to fix

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

                          <Link className="single-link" to={routeRoutes.myProfile}>
                            <Text size="16">{t<string>("Footer.UserProfile")}</Text>
                          </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 203..205
          src/components/_App/Footer/index.tsx on lines 206..208
          src/components/_App/Footer/index.tsx on lines 215..217
          src/components/_App/Footer/index.tsx on lines 218..220
          src/components/_App/Footer/index.tsx on lines 223..225

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

          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

                            <Link className="single-link" to={routeRoutes.login}>
                              <Text size="16">{t<string>("Header.Login")}</Text>
                            </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 203..205
          src/components/_App/Footer/index.tsx on lines 206..208
          src/components/_App/Footer/index.tsx on lines 210..212
          src/components/_App/Footer/index.tsx on lines 218..220
          src/components/_App/Footer/index.tsx on lines 223..225

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

          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

                        <Link className="single-link" to={routeRoutes.courses}>
                          <Text size="16">{t<string>("Footer.Courses")}</Text>
                        </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 203..205
          src/components/_App/Footer/index.tsx on lines 210..212
          src/components/_App/Footer/index.tsx on lines 215..217
          src/components/_App/Footer/index.tsx on lines 218..220
          src/components/_App/Footer/index.tsx on lines 223..225

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

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

          const SwiperButtons = styled.div`
            position: absolute;
            top: 10px;
            right: 10px;
            display: flex;
          Severity: Major
          Found in src/components/Courses/CoursesSlider/swiper.tsx and 4 other locations - About 1 hr to fix
          src/components/Common/Pagination/index.tsx on lines 6..38
          src/components/_App/Navbar/index.tsx on lines 202..212
          src/pages/register/index.tsx on lines 52..106
          src/pages/user/my-notifications.tsx on lines 10..40

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

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

          const LastMobileMenuItem = styled.div`
            span {
              font-size: 13px;
              font-family: ${({ theme }) => theme.font};
              color: ${({ theme }) => theme.textColor};
          Severity: Major
          Found in src/components/_App/Navbar/index.tsx and 4 other locations - About 1 hr to fix
          src/components/Common/Pagination/index.tsx on lines 6..38
          src/components/Courses/CoursesSlider/swiper.tsx on lines 11..38
          src/pages/register/index.tsx on lines 52..106
          src/pages/user/my-notifications.tsx on lines 10..40

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

          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

                        <Link className="single-link" to={routeRoutes.home}>
                          <Text size="16">{t<string>("Footer.HomePage")}</Text>
                        </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 206..208
          src/components/_App/Footer/index.tsx on lines 210..212
          src/components/_App/Footer/index.tsx on lines 215..217
          src/components/_App/Footer/index.tsx on lines 218..220
          src/components/_App/Footer/index.tsx on lines 223..225

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

          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

                            <Link className="single-link" to={routeRoutes.register}>
                              <Text size="16">{t<string>("Header.Register")}</Text>
                            </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 203..205
          src/components/_App/Footer/index.tsx on lines 206..208
          src/components/_App/Footer/index.tsx on lines 210..212
          src/components/_App/Footer/index.tsx on lines 215..217
          src/components/_App/Footer/index.tsx on lines 223..225

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

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

          const StyledContent = styled.div`
            background-color: ${({ theme }) => theme.gray4};
            padding-top: 100px;
            height: calc(100vh - 452px);
            @media (max-width: 991px) {
          Severity: Major
          Found in src/pages/register/index.tsx and 4 other locations - About 1 hr to fix
          src/components/Common/Pagination/index.tsx on lines 6..38
          src/components/Courses/CoursesSlider/swiper.tsx on lines 11..38
          src/components/_App/Navbar/index.tsx on lines 202..212
          src/pages/user/my-notifications.tsx on lines 10..40

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

          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

                        <Link className="single-link" to={routeRoutes.cart}>
                          <Text size="16">{t<string>("Footer.Cart")}</Text>
                        </Link>
          Severity: Major
          Found in src/components/_App/Footer/index.tsx and 5 other locations - About 1 hr to fix
          src/components/_App/Footer/index.tsx on lines 203..205
          src/components/_App/Footer/index.tsx on lines 206..208
          src/components/_App/Footer/index.tsx on lines 210..212
          src/components/_App/Footer/index.tsx on lines 215..217
          src/components/_App/Footer/index.tsx on lines 218..220

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

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

          const StyledPagination = styled.div`
            display: flex;
            justify-content: flex-start;
            align-items: center;
            a {
          Severity: Major
          Found in src/components/Common/Pagination/index.tsx and 4 other locations - About 1 hr to fix
          src/components/Courses/CoursesSlider/swiper.tsx on lines 11..38
          src/components/_App/Navbar/index.tsx on lines 202..212
          src/pages/register/index.tsx on lines 52..106
          src/pages/user/my-notifications.tsx on lines 10..40

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

          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