atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

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

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

                                                        <div
                                                            className="relative hover:cursor-pointer"
                                                            onMouseEnter={() => setRatingTab(true)}
                                                            onMouseLeave={() => setRatingTab(false)}
                                                        >
            Severity: Major
            Found in src/pages/SingleProduct.tsx and 1 other location - About 3 hrs to fix
            src/components/product/review/AllReview.tsx on lines 114..127

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

            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

                        <p
                            className={`relative text-center cursor-pointer ${
                                active === '/profile' ? 'text-primary-lightblue' : ''
                            } hover:text-primary-lightblue`}
                            onClick={() => handleClick('/profile')}
            Severity: Major
            Found in src/components/UserProfileSideBox.tsx and 1 other location - About 3 hrs to fix
            src/components/UserProfileSideBox.tsx on lines 27..39

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

            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

                        <p
                            className={`relative text-center cursor-pointer ${
                                active === '/password' ? 'text-primary-lightblue' : ''
                            } hover:text-primary-lightblue`}
                            onClick={() => handleClick('/password')}
            Severity: Major
            Found in src/components/UserProfileSideBox.tsx and 1 other location - About 3 hrs to fix
            src/components/UserProfileSideBox.tsx on lines 14..26

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

            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="relative hover:cursor-pointer"
                                                onMouseEnter={() => setRatingTab(true)}
                                                onMouseLeave={() => setRatingTab(false)}
                                            >
            Severity: Major
            Found in src/components/product/review/AllReview.tsx and 1 other location - About 3 hrs to fix
            src/pages/SingleProduct.tsx on lines 171..184

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

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

                                <div className="flex items-center justify-center flex-row">
                                    <ReactPaginate
                                        previousLabel={<GrPrevious />}
                                        nextLabel={<GrNext />}
                                        breakLabel={'...'}
            Severity: Major
            Found in src/components/adminDashboard/getUser.tsx and 2 other locations - About 3 hrs to fix
            src/pages/dashboard/seller/SellerProductsPage.tsx on lines 137..150
            src/pages/dashboard/seller/categories/CategoriesPage.tsx on lines 110..123

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

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

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

                                  <div className="flex items-center justify-center">
                                      <ReactPaginate
                                          previousLabel={<GrPrevious />}
                                          nextLabel={<GrNext />}
                                          breakLabel={'...'}
              Severity: Major
              Found in src/pages/dashboard/seller/categories/CategoriesPage.tsx and 2 other locations - About 3 hrs to fix
              src/components/adminDashboard/getUser.tsx on lines 218..231
              src/pages/dashboard/seller/SellerProductsPage.tsx on lines 137..150

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

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

                                  <div className="flex items-center justify-center">
                                      <ReactPaginate
                                          previousLabel={<GrPrevious />}
                                          nextLabel={<GrNext />}
                                          breakLabel={'...'}
              Severity: Major
              Found in src/pages/dashboard/seller/SellerProductsPage.tsx and 2 other locations - About 3 hrs to fix
              src/components/adminDashboard/getUser.tsx on lines 218..231
              src/pages/dashboard/seller/categories/CategoriesPage.tsx on lines 110..123

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

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

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

                                                                          <td className="cursor-pointer ">
                                                                              <BsThreeDotsVertical
                                                                                  onClick={() => toggleItemModel(idx)}
                                                                                  aria-label="toggle_modal"
                                                                              />
                  Severity: Major
                  Found in src/pages/dashboard/seller/SellerProductsPage.tsx and 1 other location - About 3 hrs to fix
                  src/components/dashboard/buyer/OrderTableRow.tsx on lines 41..55

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

                  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

                              <td className="cursor-pointer">
                                  <BsThreeDotsVertical
                                      onClick={() => toggleItemModel(idx)}
                                      aria-label="toggle_modal"
                                  />
                  Severity: Major
                  Found in src/components/dashboard/buyer/OrderTableRow.tsx and 1 other location - About 3 hrs to fix
                  src/pages/dashboard/seller/SellerProductsPage.tsx on lines 113..127

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

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

                    Severity
                    Category
                    Status
                    Source
                    Language