atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

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

    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

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

                                    <div className="">
                                        <input
                                            type="text"
                                            placeholder="Subject"
                                            {...register('subject')}
        Severity: Major
        Found in src/pages/Contacts.tsx and 3 other locations - About 2 hrs to fix
        src/pages/Contacts.tsx on lines 116..128
        src/pages/Contacts.tsx on lines 130..142
        src/pages/Contacts.tsx on lines 158..170

        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 87.

        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 4 locations. Consider refactoring.
        Open

                                    <div className="">
                                        <input
                                            type="text"
                                            placeholder="First name"
                                            {...register('firstName')}
        Severity: Major
        Found in src/pages/Contacts.tsx and 3 other locations - About 2 hrs to fix
        src/pages/Contacts.tsx on lines 116..128
        src/pages/Contacts.tsx on lines 144..156
        src/pages/Contacts.tsx on lines 158..170

        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 87.

        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 4 locations. Consider refactoring.
        Open

                                    <div className="">
                                        <input
                                            type="text"
                                            placeholder="Email"
                                            {...register('email')}
        Severity: Major
        Found in src/pages/Contacts.tsx and 3 other locations - About 2 hrs to fix
        src/pages/Contacts.tsx on lines 116..128
        src/pages/Contacts.tsx on lines 130..142
        src/pages/Contacts.tsx on lines 144..156

        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 87.

        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 4 locations. Consider refactoring.
        Open

                                    <div className="">
                                        <input
                                            type="text"
                                            placeholder="Last name"
                                            {...register('lastName')}
        Severity: Major
        Found in src/pages/Contacts.tsx and 3 other locations - About 2 hrs to fix
        src/pages/Contacts.tsx on lines 130..142
        src/pages/Contacts.tsx on lines 144..156
        src/pages/Contacts.tsx on lines 158..170

        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 87.

        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 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

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

                  export const DashboardCategories = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                      return decoded?.role === 'SELLER' ? (
                          <CategoriesPage />
                      ) : decoded?.role === 'ADMIN' ? (
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 13..23
                  src/utils/DashboardUtils.tsx on lines 24..34
                  src/utils/DashboardUtils.tsx on lines 50..60
                  src/utils/DashboardUtils.tsx on lines 62..72
                  src/utils/DashboardUtils.tsx on lines 86..96

                  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 85.

                  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 6 locations. Consider refactoring.
                  Open

                  export const AddProducts = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                  
                      return decoded?.role === 'ADMIN' ? (
                          <NotFound />
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 13..23
                  src/utils/DashboardUtils.tsx on lines 24..34
                  src/utils/DashboardUtils.tsx on lines 62..72
                  src/utils/DashboardUtils.tsx on lines 86..96
                  src/utils/DashboardUtils.tsx on lines 98..107

                  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 85.

                  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 6 locations. Consider refactoring.
                  Open

                  export const DashboardSingleProducts = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                  
                      return decoded?.role === 'ADMIN' ? (
                          <NotFound />
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 13..23
                  src/utils/DashboardUtils.tsx on lines 50..60
                  src/utils/DashboardUtils.tsx on lines 62..72
                  src/utils/DashboardUtils.tsx on lines 86..96
                  src/utils/DashboardUtils.tsx on lines 98..107

                  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 85.

                  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 6 locations. Consider refactoring.
                  Open

                  export const Users = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                  
                      return decoded?.role === 'ADMIN' ? (
                          <AdminDashboardAllUser />
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 13..23
                  src/utils/DashboardUtils.tsx on lines 24..34
                  src/utils/DashboardUtils.tsx on lines 50..60
                  src/utils/DashboardUtils.tsx on lines 86..96
                  src/utils/DashboardUtils.tsx on lines 98..107

                  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 85.

                  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 6 locations. Consider refactoring.
                  Open

                  export const EditRole = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                  
                      return decoded?.role === 'ADMIN' ? (
                          <EditUser />
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 13..23
                  src/utils/DashboardUtils.tsx on lines 24..34
                  src/utils/DashboardUtils.tsx on lines 50..60
                  src/utils/DashboardUtils.tsx on lines 62..72
                  src/utils/DashboardUtils.tsx on lines 98..107

                  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 85.

                  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 6 locations. Consider refactoring.
                  Open

                  export const DashboardProducts = () => {
                      const decoded = fetchInfo() as UserInfoTypes;
                  
                      return decoded?.role === 'ADMIN' ? (
                          <NotFound />
                  Severity: Major
                  Found in src/utils/DashboardUtils.tsx and 5 other locations - About 2 hrs to fix
                  src/utils/DashboardUtils.tsx on lines 24..34
                  src/utils/DashboardUtils.tsx on lines 50..60
                  src/utils/DashboardUtils.tsx on lines 62..72
                  src/utils/DashboardUtils.tsx on lines 86..96
                  src/utils/DashboardUtils.tsx on lines 98..107

                  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 85.

                  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

                  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
                    Severity
                    Category
                    Status
                    Source
                    Language