atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

Function SingleOrders has 148 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const SingleOrders = () => {
    const dispatch = useAppDispatch();
    const { id } = useParams<{ id: string }>();
    const { isLoading, singleOrder } = useAppSelector((state) => state.order);

Severity: Major
Found in src/pages/dashboard/buyer/order/SingleOrders.tsx - About 5 hrs to fix

    Function SellerSingleProduct has 141 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SellerSingleProduct = () => {
        const { id } = useParams();
        const { isLoading, singleProduct } = useAppSelector((state) => state.product);
        const { availability } = useAppSelector((state) => state.productAvailability);
        const dispatch = useAppDispatch();
    Severity: Major
    Found in src/pages/dashboard/seller/SellerSingleProduct.tsx - About 5 hrs to fix

      Function AdminStat has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function AdminStat() {
          const dispatch = useAppDispatch();
          const data = useAppSelector((state) => state.adminStatsSlice);
      
          useEffect(() => {
      Severity: Major
      Found in src/components/adminDashboard/AdminStat.tsx - About 5 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                                <thead className="bg-[#256490] text-neutral-white text-left overflow-hidden rounded-3xl p2">
                                    <tr className="rounded-xl text-sm ipad:text-base text-center">
                                        <th>Order Id</th>
                                        <th>Order Date</th>
                                        <th>Delivery Date</th>
        Severity: Major
        Found in src/components/dashboard/buyer/OrderTableComp.tsx and 1 other location - About 5 hrs to fix
        src/components/wishes/Seller/WishlistTable.tsx on lines 20..31

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                            <thead className="bg-[#256490] text-neutral-white text-left overflow-hidden rounded-3xl p2">
                                <tr className="rounded-xl text-sm text-center">
                                    <th>No</th>
                                    <th>Image</th>
                                    <th>Name</th>
        Severity: Major
        Found in src/components/wishes/Seller/WishlistTable.tsx and 1 other location - About 5 hrs to fix
        src/components/dashboard/buyer/OrderTableComp.tsx on lines 26..37

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function SellerProductsPage has 133 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SellerProductsPage = () => {
            const { isLoading } = useAppSelector((state) => state.product);
            // eslint-disable-next-line react-hooks/exhaustive-deps
            const data = useAppSelector((state) => state.product.products) || [];
            const dispatch = useAppDispatch();
        Severity: Major
        Found in src/pages/dashboard/seller/SellerProductsPage.tsx - About 5 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                                  <div className="departments cursor-pointer flex ipad:p-4 w-[100%] mobile:w-[100%] ipad:w-[40%] laptop:w-[28%]">
                                      <div className="depart_icon z-20 w-[60%] mobile:w-[50%] laptop:w-[90%] bg-primary-lightblue p-2 flex items-center h-12 justify-between gap-2 mt-6 rounded-t-md relative">
                                          <img src={depart_icon} alt="depart_icon" className="w-6 h-10" />
                                          <h1 className="text-md font-semibld text-neutral-white">
                                              {searchInputs.categoryName
          Severity: Major
          Found in src/pages/ProductsPage.tsx and 1 other location - About 5 hrs to fix
          src/pages/LandingProduct.tsx on lines 68..85

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 138.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                                  <div className="departments cursor-pointer flex ipad:p-4 w-[100%] mobile:w-[100%] ipad:w-[40%] laptop:w-[28%]">
                                      <div className="depart_icon z-10 w-[60%] mobile:w-[50%] laptop:w-[90%] bg-primary-lightblue p-2 flex items-center h-12 justify-between gap-2 mt-6 rounded-t-md relative">
                                          <img src={depart_icon} alt="depart_icon" className="w-6 h-10" />
                                          <h1 className="text-md font-semibld text-neutral-white">
                                              {searchInputs.categoryName
          Severity: Major
          Found in src/pages/LandingProduct.tsx and 1 other location - About 5 hrs to fix
          src/pages/ProductsPage.tsx on lines 102..119

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 138.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      <form className="flex flex-col gap-9" onSubmit={handleSubmit(onSubmit)}>
                          <FormInput
                              type="email"
                              placeholder="Enter your email here"
                              otherStyles="text-center bg-neutral-white border border-overlay w-full rounded-sm py-1 mobile:py-2 mb-2"
          Severity: Major
          Found in src/components/forgottonPassword/ForgottonPasswordForm.tsx and 1 other location - About 5 hrs to fix
          src/pages/auth/TwoFactor.tsx on lines 78..105

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 135.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                              <form
                                  className="flex flex-col gap-9"
                                  onSubmit={handleSubmit(onSubmit)}
                              >
                                  <FormInput
          Severity: Major
          Found in src/pages/auth/TwoFactor.tsx and 1 other location - About 5 hrs to fix
          src/components/forgottonPassword/ForgottonPasswordForm.tsx on lines 50..74

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 135.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function UpdateOrderModal has 118 lines of code (exceeds 25 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: Major
          Found in src/pages/dashboard/seller/Sales/UpdateOrderModal.tsx - About 4 hrs to fix

            Function Nav has 116 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Nav = () => {
                // eslint-disable-next-line @typescript-eslint/no-explicit-any
                const accessToken = localStorage.getItem('access_token') || '';
                const dispatch = useAppDispatch();
                const openModel = useAppSelector((state) => state.nav.openModel);
            Severity: Major
            Found in src/components/Nav.tsx - About 4 hrs to fix

              Function RegisterForm has 115 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const RegisterForm = () => {
                  const { showErrorMessage, showSuccessMessage } = useToast();
                  const { show } = useHandleResize();
                  const dispatch = useAppDispatch();
                  const navigate = useNavigate();
              Severity: Major
              Found in src/components/auth/RegisterForm.tsx - About 4 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    const onSubmit: SubmitHandler<RegisterSchemaType> = async (
                        data: RegisterSchemaType,
                    ) => {
                        try {
                            const res = await dispatch(registera(data)).unwrap();
                Severity: Major
                Found in src/components/auth/RegisterForm.tsx and 1 other location - About 4 hrs to fix
                src/components/forgottonPassword/ForgottonPasswordForm.tsx on lines 31..46

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 126.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    const onSubmit: SubmitHandler<ForgotPasswordType> = async (
                        data: ForgotPasswordType,
                    ) => {
                        try {
                            const res = await dispatch(forgotPassword(data)).unwrap();
                Severity: Major
                Found in src/components/forgottonPassword/ForgottonPasswordForm.tsx and 1 other location - About 4 hrs to fix
                src/components/auth/RegisterForm.tsx on lines 33..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 126.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function Notification has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Notification = () => {
                    const dispatch = useAppDispatch();
                    const { accessToken } = useToken();
                    const notificationPlayer = useRef<HTMLAudioElement>(null);
                    const [notificationActive, setNotificationActive] = useState(false);
                Severity: Major
                Found in src/components/notification/Notification.tsx - About 4 hrs to fix

                  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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                                          {props.useR &&
                                                              roles?.data &&
                                                              roles?.data
                                                                  .filter(
                                                                      (item: roleType) => item.id === props.useR[0]?.role,
                      Severity: Major
                      Found in src/components/Forms/editUserForm.tsx and 1 other location - About 4 hrs to fix
                      src/components/Forms/editUserForm.tsx on lines 207..217

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 120.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                                          {props.useR &&
                                                              roles?.data &&
                                                              roles?.data
                                                                  .filter(
                                                                      (item: roleType) => item.id !== props.useR[0]?.role,
                      Severity: Major
                      Found in src/components/Forms/editUserForm.tsx and 1 other location - About 4 hrs to fix
                      src/components/Forms/editUserForm.tsx on lines 196..206

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 120.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language