atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 88 of 262 total issues

Function UpdatePassword has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const UpdatePassword = () => {
    const dispatch = useAppDispatch();
    const { showErrorMessage, showSuccessMessage } = useToast();
    const { isLoading, error } = useAppSelector((state) => state.updatePassword);
    const { data } = useAppSelector((state) => state.profile);
Severity: Major
Found in src/components/Layouts/UpdatePassword.tsx - About 4 hrs to fix

    Function CategoriesPage has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const CategoriesPage = () => {
        const [categoryData, setCategoryData] = useState<categorySchemaType | null>(
            null,
        );
        const { isLoading, categories, isCategoryModelOpen } = useAppSelector(
    Severity: Major
    Found in src/pages/dashboard/seller/categories/CategoriesPage.tsx - About 4 hrs to fix

      Function About has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const About = () => {
          return (
              <div className="flex flex-col min-h-screen py-0 gap-6 px-[5%] mt-10 mobile:mt-5 laptop:mt-36">
                  <div className=" flex flex-col-reverse gap-7 tablet:flex-row tablet:relative laptop:top-0">
                      <div className="flex flex-col ipad:justify-center gap-6 tablet:py-16 tablet:h-[50%] laptop:h-screen relative tablet:w-[100%] tablet:gap-16 ipad:w-[60%] laptop:py-0 laptop:gap-10">
      Severity: Major
      Found in src/pages/About.tsx - About 4 hrs to fix

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

        const ChatModal = () => {
            const dispatch = useAppDispatch();
            const { chat } = useAppSelector((state) => state.chat);
            const { accessToken } = useToken();
            const socket = useRef<Socket | null>(null);
        Severity: Major
        Found in src/components/chat/ChatModal.tsx - About 4 hrs to fix

          Function Wishlist has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Wishlist() {
              const wishes = usePagination();
              const [activeDeleteModal, setActiveDeteleModal] = useState('');
              const { isLoading } = useAppSelector((state) => state.fetchWishes);
          
          
          Severity: Major
          Found in src/pages/Wishlist.tsx - About 3 hrs to fix

            Function Routers has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Routers() {
                const { isLoggedOut } = useAppSelector((state) => state.logout);
            
                const navigate = useNavigate();
                const accessToken = localStorage.getItem('access_token') || '';
            Severity: Major
            Found in src/routes/index.tsx - About 3 hrs to fix

              Function TwoFactorAuth has 93 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const TwoFactorAuth = () => {
                  const navigate = useNavigate();
                  const [searchParams] = useSearchParams();
              
                  const token = searchParams.get('token');
              Severity: Major
              Found in src/pages/auth/TwoFactor.tsx - About 3 hrs to fix

                Function LoginForm has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const LoginForm = () => {
                    const { isLoading } = useAppSelector((state) => state.login);
                    const { showErrorMessage, showSuccessMessage } = useToast();
                    const { saveAccessToken } = useToken();
                    const { show } = useHandleResize();
                Severity: Major
                Found in src/components/auth/LoginForm.tsx - About 3 hrs to fix

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

                  function PaymentToggleModel() {
                      const navigate = useNavigate();
                      const dispatch = useAppDispatch();
                      const [current, setCurrent] = useState(0);
                      const [previousStep, setPreviousStep] = useState(0);
                  Severity: Minor
                  Found in src/components/payment/PaymentToggleModel.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 Querries has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const Querries = () => {
                      const dispatch = useAppDispatch();
                      const { isLoading, querries } = useAppSelector((state) => state.queries);
                      const navigate = useNavigate();
                  
                  
                  Severity: Major
                  Found in src/pages/Admin/Querries.tsx - About 3 hrs to fix

                    Function SalesPage has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const SalesPage = () => {
                        const dispatch = useAppDispatch();
                        const {
                            isLoading,
                            allSalesData: sales,
                    Severity: Major
                    Found in src/pages/dashboard/seller/Sales/SalesPage.tsx - About 3 hrs to fix

                      Function CartPage has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const CartPage = () => {
                          const { carts, numberOfItem } = useAppSelector((state) => state.cart);
                          const dispatch = useAppDispatch();
                          const { openTaggle } = useAppSelector((state) => state.toggle);
                          const paymentToggleModel = (): boolean => {
                      Severity: Major
                      Found in src/components/carts/CartPage.tsx - About 3 hrs to fix

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

                        function AllReview(props: reviewType) {
                            const [ratingTab, setRatingTab] = useState(false);
                            const data = useAppSelector(
                                (state) => state.fetchReview.data[state.fetchReview.data.length - 1]?.data,
                            );
                        Severity: Minor
                        Found in src/components/product/review/AllReview.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 SingleSale has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const SingleSale: React.FC = () => {
                            const dispatch = useAppDispatch();
                            const { singleSaleData: sale, isLoading } = useAppSelector(
                                (state: RootState) => state.sales,
                            );
                        Severity: Major
                        Found in src/pages/dashboard/seller/Sales/SingleSale.tsx - About 3 hrs to fix

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

                          const ResetPasswordForm = () => {
                              const [searchParams] = useSearchParams();
                              const token = searchParams.get('token');
                          
                              const { isLoading } = useAppSelector((state) => state.resetPassword);
                          Severity: Major
                          Found in src/components/ResetPassword/ResetPasswordForm.tsx - About 2 hrs to fix

                            Function SingleProduct has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const SingleProduct = () => {
                                const { isLoading, singleProduct } = useAppSelector((state) => state.product);
                            
                                const dispatch = useAppDispatch();
                                const review = useAppSelector(
                            Severity: Minor
                            Found in src/pages/SingleProduct.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 RatingModel has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function RatingModel() {
                                const data = useAppSelector(
                                    (state) => state.fetchReview.data[state.fetchReview.data.length - 1]?.data,
                                );
                            
                            
                            Severity: Major
                            Found in src/components/product/review/ratingModel.tsx - About 2 hrs to fix

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

                                      const updateChart = () => {
                                          if (allSalesData.length > 0) {
                                              chartData.forEach((monthData) => {
                                                  monthData.approvals = 0;
                                                  monthData.rejected = 0;
                              Severity: Major
                              Found in src/pages/dashboard/seller/SellerDashboard.tsx - About 2 hrs to fix

                                File PaymentToggleModel.tsx has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /* eslint-disable prefer-const */
                                import { useEffect, useState } from 'react';
                                import momoIcon from '../../assets/momo.png';
                                import PaymentButton from '../buttons/PaymentButton';
                                import { useAppSelector, useAppDispatch } from '../../redux/hooks/hooks';
                                Severity: Minor
                                Found in src/components/payment/PaymentToggleModel.tsx - About 2 hrs to fix

                                  File ProfileUser.tsx has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { useEffect, useState } from 'react';
                                  import { zodResolver } from '@hookform/resolvers/zod';
                                  import { SubmitHandler, useForm, useWatch } from 'react-hook-form';
                                  import Upload from '../../assets/upload.svg';
                                  import FormInput from '../Forms/InputText';
                                  Severity: Minor
                                  Found in src/components/auth/ProfileUser.tsx - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language