EscolaLMS/Front

View on GitHub

Showing 162 of 559 total issues

Function useCoursesFilter has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const useCoursesFilter = () => {
  const { courses, params, setParams, loading } = useContext(CoursesContext);
  const { fetchCategories, categoryTree } = useContext(EscolaLMSContext);
  const [prevCategories, setPrevCategories] = useState<Category[]>([]);
  const history = useHistory();
Severity: Major
Found in src/hooks/courses/useCoursesFIlter.ts - About 4 hrs to fix

    Function Index has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const Index = () => {
      const { categoryTree, settings, fetchCategories, user } =
        useContext(EscolaLMSContext);
    
      const history = useHistory();
    Severity: Major
    Found in src/pages/index.tsx - About 3 hrs to fix

      Function Navbar has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

      const Navbar = () => {
        const { t } = useTranslation();
        const {
          showModal,
          closeModal,
      Severity: Minor
      Found in src/components/_App/Navbar/index.tsx - About 3 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 PromotedCoursesSection has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const PromotedCoursesSection: React.FC = () => {
        const { courses, loading } = useFetchCourses({
          per_page: 8,
        });
      
      
      Severity: Major
      Found in src/components/Courses/PromotedCoursesSection/index.tsx - About 3 hrs to fix

        Function Routes has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Routes: React.FC = (): ReactElement => {
          const {
            home,
            // authentication,
            page,
        Severity: Major
        Found in src/components/Routes/index.tsx - About 3 hrs to fix

          Function WebinarInfo has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const WebinarInfo = () => {
            const { webinar } = useContext(EscolaLMSContext);
            const { t } = useTranslation();
          
            if (!webinar.value) {
          Severity: Major
          Found in src/components/Webinars/Webinar/WebinarInfo/index.tsx - About 3 hrs to fix

            Function ConsultationSidebar has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            const ConsultationSidebar: React.FC<ConsultationSidebarProps> = (props) => {
              const { consultation } = props;
              const { cart, addToCart, user } = useContext(EscolaLMSContext);
              const { t } = useTranslation();
              const { push } = useHistory();
            Severity: Minor
            Found in src/components/Consultations/Consultation/ConsultationSidebar.tsx - About 3 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 ProfileCourses has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            const ProfileCourses = ({
              filter = CourseStatus.ALL,
            }: {
              filter: CourseStatus;
            }) => {
            Severity: Minor
            Found in src/components/Profile/ProfileCourses/index.tsx - About 3 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 CoursePanelProvider has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

            const CoursePanelProvider: React.FC<React.PropsWithChildren> = ({
              children,
            }) => {
              const {
                sendProgress,
            Severity: Minor
            Found in src/components/Courses/Course/Context/index.tsx - About 3 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 CoursesCollection has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const CoursesCollection: React.FC = () => {
              const [mobileDrawerState, setMobileDrawerState] = React.useState<{
                showDrawer: boolean;
                type: keyof typeof MobileDrawerTypes;
              }>({
            Severity: Major
            Found in src/components/Courses/CoursesCollection/index.tsx - About 3 hrs to fix

              Function Onboarding has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

              const Onboarding = () => {
                const { settings, fetchSettings, updateProfile, fetchProfile, user } =
                  useContext(EscolaLMSContext);
                const { t, i18n } = useTranslation();
                const history = useHistory();
              Severity: Minor
              Found in src/components/Onboarding/index.tsx - About 3 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 CoursePanelFinishPage has 80 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 3 hrs to fix

                Function EventInfo has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const EventInfo = () => {
                  const { stationaryEvent } = useContext(EscolaLMSContext);
                  const { t } = useTranslation();
                
                  if (!stationaryEvent.value) {
                Severity: Major
                Found in src/components/Events/Event/EventInfo/index.tsx - About 3 hrs to fix

                  Function Footer has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Footer = () => {
                    const { settings, fetchPages, pages, user } = useContext(EscolaLMSContext);
                    const { t, i18n } = useTranslation();
                    useEffect(() => {
                      fetchPages();
                  Severity: Minor
                  Found in src/components/_App/Footer/index.tsx - About 3 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 useSearchParams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useSearchParams = () => {
                    const { search, pathname } = useLocation();
                    const history = useHistory();
                  
                    const query = useMemo(() => new URLSearchParams(search), [search]);
                  Severity: Major
                  Found in src/hooks/useSearchParams.ts - About 3 hrs to fix

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

                    const ConsultationsCollection = () => {
                      const { consultations } = useContext(ConsultationsContext);
                      const { t } = useTranslation();
                    
                      const consultationsCategories = consultations?.list?.data?.map((item) =>
                    Severity: Major
                    Found in src/components/Consultations/List/ConsultationsCollection/index.tsx - About 3 hrs to fix

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

                      export const PackageInfo = () => {
                        const { product } = useContext(EscolaLMSContext);
                        const { t } = useTranslation();
                      
                        if (!product.value) {
                      Severity: Major
                      Found in src/components/Packages/Package/PackageInfo/index.tsx - About 3 hrs to fix

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

                        const Consultation = () => {
                          const { t } = useTranslation();
                          const { id } = useParams<{ id: string }>();
                          const { consultation, fetchConsultation, consultations } =
                            useContext(EscolaLMSContext);
                        Severity: Major
                        Found in src/components/Consultations/Consultation/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
                              Severity
                              Category
                              Status
                              Source
                              Language