EscolaLMS/Front

View on GitHub

Showing 173 of 585 total issues

Function ConsultationsProvider has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ConsultationsProvider: React.FC<PropsWithChildren> = (props) => {
  const { children } = props;
  const [params, setParams] = useState<API.CourseParams>({
    page: 1,
    per_page: COURSES_ON_PAGE,
Severity: Minor
Found in src/components/Consultations/List/ConsultationsProvider.tsx - About 1 hr to fix

    Function renderProperOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        (option: OnboardingOption) => {
          switch (step.type) {
            case OnboardingStepType.radio:
              return (
                <Radio
    Severity: Minor
    Found in src/components/Onboarding/Step/index.tsx - About 1 hr to fix

      Function ResetPassword has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ResetPassword: React.FC = () => {
        const { push } = useHistory();
        const { search } = useLocation();
        const email = search && search.split("&")[0].split("=")[1];
        const token = search && search.split("&")[1].split("=")[1];
      Severity: Minor
      Found in src/pages/reset-password/index.tsx - About 1 hr to fix

        Function CoursePageContentSkeleton has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const CoursePageContentSkeleton = () => {
          return (
            <SkeletonWrapper>
              <Skeleton width={"20px"} style={{ marginBottom: "5px" }} />
              <Skeleton width={"40%"} height={37} style={{ marginBottom: "10px" }} />
        Severity: Minor
        Found in src/components/Skeletons/CoursePage/content.tsx - About 1 hr to fix

          Function handleFetchQuestionnairesAnswers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              (page: number) => {
                if (questionId && courseId) {
                  setLoading(true);
                  fetchQuestionnairesAnswers(
                    QuestionnaireModelType.COURSE,
          Severity: Minor
          Found in src/hooks/courses/useCourseAnswers.ts - About 1 hr to fix

            Function getFormattedDifferenceRelativeToNow has 30 lines of code (exceeds 25 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 1 hr to fix

              Function ConsultationHero has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ConsultationHero: React.FC<ConsultationHeroProps> = (props) => {
                const { consultation } = props;
                const history = useHistory();
              
                return (
              Severity: Minor
              Found in src/components/Consultations/Consultation/ConsultationHero.tsx - About 1 hr to fix

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

                        Function onClick has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          const onClick = useCallback(async () => {
                            if (consultation.consultation_term_id && selectedDate) {
                              setLoading(true);
                        
                              try {
                        Severity: Minor
                        Found in src/components/Book/BookTermModal/UserSelectDatePicker/index.tsx - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                            if (isMobile) {
                              return (
                                <StyledHeader>
                                  <Navigation
                                    mobile
                          Severity: Major
                          Found in src/components/_App/Navbar/index.tsx - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language