EscolaLMS/Front

View on GitHub

Showing 162 of 559 total issues

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 = useMemo(
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 GetCertificate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const GetCertificate: React.FC<Props> = ({ courseId }) => {
  const { fetchCertificates } = useContext(EscolaLMSContext);
  const { downloadCertificate, loadingId } = useCertificateDownload();
  const { t } = useTranslation();
  const [noCertificates, setNoCertificates] = useState(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 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 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 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 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

        Function Step has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const Step: React.FC<Props> = ({ step, onAnswer, answers }) => {
          const { settings } = useContext(EscolaLMSContext);
          const { i18n } = useTranslation();
        
          const getImage = useCallback(() => {
        Severity: Minor
        Found in src/components/Onboarding/Step/index.tsx - About 55 mins 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 UserSelectDatePicker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const UserSelectDatePicker = ({ consultation, onClose }: Props) => {
          const [selectedDate, setSelectedDay] = useState<Date | null>(null);
          const { bookConsultationTerm } = useContext(EscolaLMSContext);
          const [loading, setLoading] = useState(false);
          const [step, setStep] = useState(1);
        Severity: Minor
        Found in src/components/Book/BookTermModal/UserSelectDatePicker/index.tsx - About 55 mins 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 useCourseBreakPoint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useCourseBreakPoint = ({ courseId, program, topic }: Props) => {
          const { courseProgressDetails, progress } = useContext(EscolaLMSContext);
          const location = useLocation();
          const { push } = useHistory();
          // if pathname contain 3 splited items we cannot fire topicbreakpoint effect otherwise we can
        Severity: Minor
        Found in src/hooks/courses/useCourseBreakPoint.ts - About 45 mins 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 ButtonsNav has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ButtonsNav = () => {
          const {
            completeCurrentTopic,
            currentTopic,
            finishedTopicsIds,
        Severity: Minor
        Found in src/components/Courses/Course/CoursePanelLayout/ButtonsNav/index.tsx - About 45 mins 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 getFormattedDifferenceRelativeToNow has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const getFormattedDifferenceRelativeToNow = (time: Date) => {
          const daysDifference = time
            ? differenceInDays(time.getTime(), new Date().getTime())
            : null;
          const hoursDifference = time
        Severity: Minor
        Found in src/utils/index.ts - About 45 mins 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 Orders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const Orders = () => {
          const { orders, fetchOrders, fetchOrderInvoice } =
            useContext(EscolaLMSContext);
        
          const { t } = useTranslation();
        Severity: Minor
        Found in src/pages/user/my-orders.tsx - About 45 mins 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 Login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const Login = () => {
          const { search, state } = useLocation<{ referrer?: string }>();
          const { user, socialAuthorize } = useContext(EscolaLMSContext);
          const [view, setView] = useState<
            "login" | "forgotPassword" | "register" | "success"
        Severity: Minor
        Found in src/pages/login/index.tsx - About 45 mins 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

        Consider simplifying this complex logical expression.
        Open

          if (isMobile) {
            return (
              <StyledHeader>
                <Navigation
                  mobile
        Severity: Major
        Found in src/components/_App/Navbar/index.tsx - About 40 mins to fix

          Function useLessonProgram has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          export function useLessonProgram(
            program: API.CourseProgram,
            courseRouteName: string = "/course/"
          ) {
            const {
          Severity: Minor
          Found in src/hooks/useLessonProgram.ts - About 35 mins 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 ConsultationsProvider has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          const ConsultationsProvider: React.FC<PropsWithChildren> = (props) => {
            const { fetchConsultations, consultations, fetchCategories } =
              useContext(EscolaLMSContext);
            const { children } = props;
            const { query, getQueryValueByName, getAllQueryValueByName, setPathname } =
          Severity: Minor
          Found in src/components/Consultations/List/ConsultationsProvider.tsx - About 35 mins 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 CourseProgramContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          }> = ({ topic, preview = false }) => {
            const { courseId, nextTopic, setIsNextTopicButtonDisabled, showFinish } =
              useCoursePanel();
          
            const { topicPing, topicIsFinished, h5pProgress, fetchCourseProgress } =
          Severity: Minor
          Found in src/components/Courses/Course/CourseProgramContent.tsx - About 35 mins 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

          Severity
          Category
          Status
          Source
          Language