EscolaLMS/Front

View on GitHub

Showing 162 of 559 total issues

Function CourseProgram has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CourseProgram = () => {
  const { t } = useTranslation();

  const { id } = useParams<{ id: string }>();
  const { program, fetchProgram } = useContext(EscolaLMSContext);
Severity: Minor
Found in src/pages/courses/preview/index.tsx - About 1 hr to fix

    Function SubscriptionBox has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const SubscriptionBox: React.FC<Props> = ({ subscription }) => {
      const { t } = useTranslation();
      const { buySubscriptionByP24, user } = usePayment();
    
      const history = useHistory();
    Severity: Minor
    Found in src/components/Subscriptions/Box/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 ProposedTermsContent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const ProposedTermsContent = ({ consultation, onClose }: Props) => {
      const [selectedDate, setSelectedDay] = useState<Date | null>(null);
      const [selectedTime, setSelectedTime] = useState<Date | null>(null);
      const [loading, setLoading] = useState(false);
      const [step, setStep] = useState(1);
    Severity: Minor
    Found in src/components/Book/BookTermModal/ProposedTermsContent/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 CourseAccessButton has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    const CourseAccessButton: React.FC<CourseAccessButtonProps> = ({
      course,
      onRequestAccess,
      setModalVisible,
    }) => {

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

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

      Function MyStationaryEvents has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const MyStationaryEvents = () => {
        const { fetchUserStationaryEvents } = useContext(EscolaLMSContext);
        const { t } = useTranslation();
        useEffect(() => {
          fetchUserStationaryEvents();
      Severity: Minor
      Found in src/pages/user/MyStationaryEvents/index.tsx - About 1 hr to fix

        Function SubscriptionsPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SubscriptionsPage = () => {
          const { t } = useTranslation();
          const {
            subscriptions,
            isLoading,
        Severity: Minor
        Found in src/pages/subscriptions/index.tsx - About 1 hr to fix

          Function CourseSchedule has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const CourseSchedule = () => {
            const { t } = useTranslation();
            const { user } = useContext(EscolaLMSContext);
            const {
              currentTopic,
          Severity: Minor
          Found in src/components/Courses/Course/CoursePanelLayout/Schedule/index.tsx - About 1 hr to fix

            Function ConsultationsContainerItems has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ConsultationsContainerItems = () => {
              const { consultations } = useContext(ConsultationsContext);
              const { setQueryParam } = useSearchParams();
              const ConsultationsLoading = consultations?.loading;
              const consultationsMeta = consultations?.list?.meta;

              Function useCart has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const useCart = () => {
                const [cart, setCart] = useState<PogressState>({
                  data: undefined,
                  loaded: false,
                  loading: false,
              Severity: Minor
              Found in src/hooks/useCart.ts - About 1 hr to fix

                Function availableTopicsIds has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const availableTopicsIds = useMemo(() => {
                    const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
                      (l) =>
                        l.active_from === null ||
                        (l.active_from && isAfter(new Date(), new Date(l.active_from)))
                Severity: Minor
                Found in src/components/Courses/Course/Context/index.tsx - About 1 hr to fix

                  Function availableTopicsIds has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const availableTopicsIds = useMemo(() => {
                      const activeLessons = (currentCourseProgram?.lessons ?? []).filter(
                        (l) =>
                          l.active_from === null ||
                          (l.active_from && isAfter(new Date(), new Date(l.active_from)))
                  Severity: Minor
                  Found in src/components/Courses/Course/CourseSidebar/index.tsx - About 1 hr to fix

                    Function Buttons has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const Buttons = useMemo(() => {
                        if (userId && product.owned) {
                          return <Text size="12">{t("PackagePage.ProductOwned")}</Text>;
                        }
                        if (productInCart) {
                    Severity: Minor
                    Found in src/components/Packages/Package/PackageSidebar/Buttons/index.tsx - About 1 hr to fix

                      Function RateCourse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const RateCourse: React.FC<Props> = ({
                        course,
                        courseId,
                        visible,
                        questionnaire,
                      Severity: Minor
                      Found in src/components/Courses/RateCourse/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 PackageSidebarButtons has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const PackageSidebarButtons = ({ product }: Props) => {
                        const { cart, addToCart, user } = useContext(EscolaLMSContext);
                        const { t } = useTranslation();
                        const { push } = useHistory();
                        const userId = user.value?.id;
                      Severity: Minor
                      Found in src/components/Packages/Package/PackageSidebar/Buttons/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 fetchPageNumbers has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        const fetchPageNumbers = () => {
                          /**
                           * totalNumbers: the total page numbers to show on the control
                           * totalBlocks: totalNumbers + 2 to cover for the left(<) and right(>) controls
                           */
                      Severity: Minor
                      Found in src/components/Common/Pagination/index.tsx - About 1 hr to fix

                        Function EventTutor has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const EventTutor = () => {
                          const { stationaryEvent } = useContext(EscolaLMSContext);
                          const { t } = useTranslation();
                        
                          const authors = stationaryEvent.value?.product?.authors;
                        Severity: Minor
                        Found in src/components/Events/Event/EventTutor/index.tsx - About 1 hr to fix

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

                            Function handleSendAnswer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                async (rate: number, note?: string) => {
                                  if (questionnaire.questions) {
                                    setState((prevState) => ({
                                      ...prevState,
                                      loading: true,
                            Severity: Minor
                            Found in src/components/Courses/RateCourse/index.tsx - About 1 hr to fix

                              Function GoTop has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const GoTop = () => {
                                const [isVisible, setIsVisible] = useState(false);
                              
                                useEffect(() => {
                                  document.addEventListener("scroll", () => {
                              Severity: Minor
                              Found in src/components/_App/GoTop/index.tsx - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language