EscolaLMS/Front

View on GitHub

Showing 173 of 585 total issues

Function ConsultationsCollection has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ConsultationsCollection = () => {
  const { consultations, loading } = useContext(ConsultationsContext);
  const { t } = useTranslation();

  const consultationsCategories = consultations?.data?.map((item) =>
Severity: Major
Found in src/components/Consultations/List/ConsultationsCollection/index.tsx - About 3 hrs to fix

    Function ChatIcon has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const ChatIcon = () => {
      return (
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="31.296"
    Severity: Major
    Found in src/icons/index.tsx - About 3 hrs to fix

      Function TutorsPage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const TutorsPage = () => {
        const { tutors, fetchTutors } = useContext(EscolaLMSContext);
      
        const { t } = useTranslation();
        const theme = useTheme();
      Severity: Major
      Found in src/pages/tutors/index.tsx - About 2 hrs to fix

        Function useSubscriptions has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const useSubscriptions = () => {
          const {
            fetchProducts,
            fetchMyProducts,
            products,
        Severity: Major
        Found in src/hooks/useSubscriptions.ts - About 2 hrs to fix

          Function CoursePanelFinishPage has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const CoursePanelFinishPage = () => {
            const [state, setState] = useState<State>({
              showModal: false,
              isAnyQuestionnaire: null,
              showCertificate: false,
          Severity: Major
          Found in src/components/Courses/Course/CoursePanelLayout/FinishPage/index.tsx - About 2 hrs to fix

            Function StaticPage has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const StaticPage = () => {
              const { slug } = useParams<{ slug: string }>();
              const { fetchPage, page, fetchPages, pages } = useContext(EscolaLMSContext);
            
              const prevSlug = usePrevious(slug);
            Severity: Major
            Found in src/pages/static-page/index.tsx - About 2 hrs to fix

              Function ConsultationsSlider has 70 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ConsultationsSlider: React.FC<ConsultationsSliderProps> = (props) => {
                const {
                  category,
                  title = category,
                  consultations,
              Severity: Major
              Found in src/components/Consultations/ConsultationsSlider/index.tsx - About 2 hrs to fix

                Function useCamera has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const useCamera = () => {
                  const [hasCameraAccess, setHasCameraAccess] = useState(false);
                  const streamRef = useRef<MediaStream | null>(null);
                  const videoRef = useRef<HTMLVideoElement | null>(null);
                
                
                Severity: Major
                Found in src/hooks/meeting/useCamera.ts - About 2 hrs to fix

                  Function EventRelatedEvents has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const EventRelatedEvents = () => {
                    const { stationaryEvents } = useContext(EscolaLMSContext);
                    const { t } = useTranslation();
                    const data = stationaryEvents.list?.data;
                  
                  
                  Severity: Major
                  Found in src/components/Events/Event/EventRelatedEvents/index.tsx - About 2 hrs to fix

                    Function MyConsultationsPage has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const MyConsultationsPage = () => {
                      const { t } = useTranslation();
                      const { isTutor } = useRoles();
                    
                      const myConsultationsTabs = useMemo(
                    Severity: Major
                    Found in src/pages/user/my-consultations.tsx - About 2 hrs to fix

                      Function Tags has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const Tags = (props: TagsProps) => {
                        const { tags, onTagClick } = props;
                        const theme = useTheme();
                        const [open, setOpen] = useState(false);
                        const firstTags = tags ? [...tags].splice(0, 2) : [];
                      Severity: Major
                      Found in src/components/Tags/index.tsx - About 2 hrs to fix

                        Function CategoriesBreadCrumbs has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const CategoriesBreadCrumbs = (props: CategoriesProps) => {
                          const { categories, onCategoryClick } = props;
                          // const [open, setOpen] = useState(false);
                          const parentRef = useRef<HTMLDivElement | null>(null);
                          const firstCategories = categories || [];
                        Severity: Major
                        Found in src/components/Categories/CategoriesBreadCrumbs/index.tsx - About 2 hrs to fix

                          Function ProfileCertificates has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const ProfileCertificates: React.FC = () => {
                            const { certificates, fetchCertificates } = useContext(EscolaLMSContext);
                            const { t } = useTranslation();
                          
                            const { downloadCertificate, loadingId } = useCertificateDownload();
                          Severity: Major
                          Found in src/components/Profile/ProfileCertificates/index.tsx - About 2 hrs to fix

                            Function usePayment has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const usePayment = () => {
                              const {
                                user,
                                cart,
                                fetchCart,
                            Severity: Minor
                            Found in src/hooks/usePayment.ts - About 2 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 CourseMainInfo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const CourseMainInfo: FC<CourseMainInfoProps> = ({ courseData }) => {
                              const { fetchQuestionnaireStarsByModel } = useContext(EscolaLMSContext);
                              const [state, setState] = useState<State>({ type: StateTypes.INIT });
                              const history = useHistory();
                            
                            
                            Severity: Minor
                            Found in src/pages/courses/course/Components/CourseMainInfo/index.tsx - About 2 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 VerifyEmail has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const VerifyEmail: React.FC = () => {
                              const { push } = useHistory();
                              const { search } = useLocation();
                              const id = search && search?.split("&")[0]?.split("=")[1];
                              const hash = search && search?.split("&")[1]?.split("=")[1];
                            Severity: Major
                            Found in src/pages/verify-email/index.tsx - About 2 hrs to fix

                              Function EventsHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const EventsHeaderFilters = () => {
                                const { params, setParams } = useContext(EventsContext);
                                const location = useLocation();
                                const parsedParams = qs.parse(location.search, {
                                  arrayFormat: "bracket",
                              Severity: Major
                              Found in src/components/Events/List/EventsHeader/Filters/index.tsx - About 2 hrs to fix

                                Function PackagesHeaderFilters has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const PackagesHeaderFilters = () => {
                                  const { params, setParams } = useContext(PackagesContext);
                                  const location = useLocation();
                                  const parsedParams = qs.parse(location.search, {
                                    arrayFormat: "bracket",
                                Severity: Major
                                Found in src/components/Packages/List/PackagesHeader/Filters/index.tsx - About 2 hrs to fix

                                  Function WebinarsHeaderFilters has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const WebinarsHeaderFilters = () => {
                                    const { params, setParams } = useContext(WebinarsContext);
                                    const location = useLocation();
                                    const parsedParams = qs.parse(location.search, {
                                      arrayFormat: "bracket",
                                  Severity: Major
                                  Found in src/components/Webinars/List/WebinarsHeader/Filters/index.tsx - About 2 hrs to fix

                                    Function CoursesDetailsSidebar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const CoursesDetailsSidebar: React.FC<Props> = ({
                                      course,
                                      onRequestAccess,
                                    }) => {
                                      const { user, courseAccess } = useContext(EscolaLMSContext);

                                    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