atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 88 of 262 total issues

Function Home has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Home = () => {
    return (
        <>
            <div className="parent_container min-h-screen pt-[8rem]">
                <div className="wrapper flex flex-col ipad:flex-row">
Severity: Major
Found in src/pages/Home.tsx - About 2 hrs to fix

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

    const SellerRedirection = () => {
        const navigate = useNavigate();
        const { requires2FA } = useAppSelector((state) => state.login);
    
        useEffect(() => {
    Severity: Major
    Found in src/pages/SellerRedirection.tsx - About 2 hrs to fix

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

      const Footer = () => {
          return (
              <>
                  <footer className="flex flex-col items-center text-dark pb-8 px-[3%]">
                      <div className="bg-custom-gradient rounded-md text-neutral-white mx-auto p-10 flex w-full gap-5 rounded-br-[3rem] rounded-bl-[3rem] flex-wrap ipad:flex-nowrap">
      Severity: Major
      Found in src/components/Footer.tsx - About 2 hrs to fix

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

        const EditUserForm = (props: userFormType) => {
            const roles = useAppSelector(
                (state) => state.allRoles.data[state.allRoles.data.length - 1],
            );
            const roleLoading = useAppSelector((state) => state.allRoles.isLoading);
        Severity: Minor
        Found in src/components/Forms/editUserForm.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 VerifiedCard has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const VerifiedCard = () => {
            const { isLoading, isVerified, message } = useAppSelector(
                (state) => state.verifyAccount,
            );
            return (
        Severity: Major
        Found in src/components/cards/VerifiedCard.tsx - About 2 hrs to fix

          Function UserRedirection has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const UserRedirection = () => {
              const navigate = useNavigate();
              const { isResetPassword } = useAppSelector((state) => state.forgotPassword);
              useEffect(() => {
                  if (!isResetPassword) {
          Severity: Major
          Found in src/pages/userRedirection.tsx - About 2 hrs to fix

            File SingleProduct.tsx has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            //import { FaCartPlus, FaPlus, FaMinus } from 'react-icons/fa';
            import { useAppDispatch, useAppSelector } from '../redux/hooks/hooks';
            import { useEffect, useState } from 'react';
            import { IoMdArrowDropdown } from 'react-icons/io';
            import { IoChevronBackSharp } from 'react-icons/io5';
            Severity: Minor
            Found in src/pages/SingleProduct.tsx - About 2 hrs to fix

              Function SingleQuerries has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const SingleQuerries = () => {
                  const dispatch = useAppDispatch();
                  const { isLoading, singleQuery } = useAppSelector((state) => state.queries);
                  const { id } = useParams<{ id: string }>();
                  const singleQueryNumber = singleQuery.length;
              Severity: Major
              Found in src/pages/Admin/SingleQuerries.tsx - About 2 hrs to fix

                File AddProductForm.tsx has 269 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { zodResolver } from '@hookform/resolvers/zod';
                import { X } from 'lucide-react';
                import { useEffect, useState } from 'react';
                import { SubmitHandler, useForm } from 'react-hook-form';
                import { useLocation, useNavigate } from 'react-router-dom';
                Severity: Minor
                Found in src/components/Forms/AddProductForm.tsx - About 2 hrs to fix

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

                  const ForgotPasswordForm = () => {
                      const { isLoading } = useAppSelector((state) => state.forgotPassword);
                      const dispatch = useAppDispatch();
                      const { showSuccessMessage, showErrorMessage } = useToast();
                      const navigate = useNavigate();
                  Severity: Major
                  Found in src/components/forgottonPassword/ForgottonPasswordForm.tsx - About 2 hrs to fix

                    File editUserForm.tsx has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /* eslint-disable react-hooks/exhaustive-deps */
                    import { useEffect } from 'react';
                    import { FaLessThan } from 'react-icons/fa';
                    import { useNavigate } from 'react-router-dom';
                    import { useAppDispatch, useAppSelector } from '../../redux/hooks/hooks';
                    Severity: Minor
                    Found in src/components/Forms/editUserForm.tsx - About 2 hrs to fix

                      Function DashboardLayout has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const DashboardLayout = () => {
                          const [activeItem, setActiveItem] = useState<string>('Dashboard');
                          const [showMenu, setShowMenu] = useState(false);
                          const { show } = useHandleResize();
                          const [currentUser, setCurrentUser] = useState<currentUserType>({
                      Severity: Minor
                      Found in src/components/Layouts/DashboardLayout.tsx - About 1 hr to fix

                        Function Orders has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const Orders = () => {
                            const dispatch = useAppDispatch();
                            const { isLoading, numberOfOrder } = useAppSelector((state) => state.order);
                            const data = useAppSelector((state) => state.order.orders);
                        
                        
                        Severity: Minor
                        Found in src/pages/dashboard/buyer/order/Orders.tsx - About 1 hr to fix

                          Function ProfileUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const ProfileUser = () => {
                              const dispatch = useAppDispatch();
                              const { data, isLoading, error } = useAppSelector((state) => state.profile);
                              const [selectedImage, setSelectedImage] = useState<File | null>(null);
                              const { showErrorMessage, showSuccessMessage } = useToast();
                          Severity: Minor
                          Found in src/components/auth/ProfileUser.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 handleMomoPay has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              const handleMomoPay: SubmitHandler<momoValidationType> = async (
                                  data: momoValidationType,
                              ) => {
                                  try {
                                      const res = await dispatch(momoPay(data)).unwrap();
                          Severity: Minor
                          Found in src/components/payment/PaymentToggleModel.tsx - About 1 hr to fix

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

                            const DashboardTopNav = () => {
                                const { show } = useHandleResize();
                                const { setShowMenu, showMenu } = useContext(toggleMenuContext);
                                const { data } = useAppSelector((state) => state.profile);
                            
                            
                            Severity: Minor
                            Found in src/components/DashboardTopNav.tsx - About 1 hr to fix

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

                              const VerifiedCard = () => {
                                  const { isLoading, isVerified, message } = useAppSelector(
                                      (state) => state.verifyAccount,
                                  );
                                  return (
                              Severity: Minor
                              Found in src/components/cards/VerifiedCard.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 UpdateOrderModal has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const UpdateOrderModal: React.FC = () => {
                                  const dispatch = useAppDispatch();
                                  const { selectedSaleId, deliveryDate, status, productName, productImage } =
                                      useAppSelector((state) => state.sales);
                                  const { isLoading } = useAppSelector((state) => state.updateOrder);
                              Severity: Minor
                              Found in src/pages/dashboard/seller/Sales/UpdateOrderModal.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 WishlistPage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const WishlistPage = () => {
                                  const dispatch = useAppDispatch();
                                  const { isLoading, wishlist } = useAppSelector((state) => state.sellerWishes);
                              
                                  useEffect(() => {
                              Severity: Minor
                              Found in src/pages/dashboard/seller/wishlist/wishlistPage.tsx - About 1 hr to fix

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

                                const ChatComponent = () => {
                                    const [chatModal, setChatModal] = useState(false);
                                    const toggleChatModal = () => {
                                        setChatModal(!chatModal);
                                    };
                                Severity: Minor
                                Found in src/components/chat/ChatComponent.tsx - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language