atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

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

                                    data.map((item: DynamicData, idx: number) => (
                                        <div
                                            className="product_card bg-neutral-white p-4 flex flex-col rounded-md shadow laptop:max-w-[100%] h-full"
                                            key={idx}
                                        >
Severity: Major
Found in src/pages/ProductsPage.tsx and 1 other location - About 3 days to fix
src/pages/LandingProduct.tsx on lines 145..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 539.

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

                                    data.slice(0, 8).map((item: DynamicData, idx: number) => (
                                        <div
                                            className="product_card bg-neutral-white p-4 flex flex-col rounded-md shadow laptop:max-w-[100%] h-full"
                                            key={idx}
                                        >
Severity: Major
Found in src/pages/LandingProduct.tsx and 1 other location - About 3 days to fix
src/pages/ProductsPage.tsx on lines 166..227

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

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 UserRedirection = () => {
    const navigate = useNavigate();
    const { isResetPassword } = useAppSelector((state) => state.forgotPassword);
    useEffect(() => {
        if (!isResetPassword) {
Severity: Major
Found in src/pages/userRedirection.tsx and 1 other location - About 2 days to fix
src/pages/SellerRedirection.tsx on lines 7..76

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

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 SellerRedirection = () => {
    const navigate = useNavigate();
    const { requires2FA } = useAppSelector((state) => state.login);

    useEffect(() => {
Severity: Major
Found in src/pages/SellerRedirection.tsx and 1 other location - About 2 days to fix
src/pages/userRedirection.tsx on lines 7..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 364.

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 CopyButton: FC<CopyType> = ({ name, text, value }) => {
    const [copied, setCopied] = useState(false);

    useEffect(() => {
        const interval = setTimeout(() => {
Severity: Major
Found in src/components/buttons/CopyBtn.tsx and 1 other location - About 1 day to fix
src/components/buttons/CopyCard.tsx on lines 7..36

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

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 CopyCard: FC<CopyType> = ({ name, text, value }) => {
    const [copied, setCopied] = useState(false);

    useEffect(() => {
        const interval = setTimeout(() => {
Severity: Major
Found in src/components/buttons/CopyCard.tsx and 1 other location - About 1 day to fix
src/components/buttons/CopyBtn.tsx on lines 7..36

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

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

                            data.map((item: DynamicData) => (
                                <div
                                    className="single-review mt-4 border-t   pt-4  border-inputCaption flex  flex-col gap-3 ipad:flex-ow ipad:gap11 ipad:justify-between "
                                    key={item.id}
                                >
Severity: Major
Found in src/components/product/review/AllReview.tsx and 1 other location - About 1 day to fix
src/pages/SingleProduct.tsx on lines 212..242

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

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

                                        review.slice(0, 2).map((item: DynamicData) => (
                                            <div
                                                className="single-review mt-4 border-t   pt-4  border-inputCaption flex  flex-col gap-3 ipad:flex-ow ipad:gap11 ipad:justify-between "
                                                key={item.id}
                                            >
Severity: Major
Found in src/pages/SingleProduct.tsx and 1 other location - About 1 day to fix
src/components/product/review/AllReview.tsx on lines 148..178

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

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 ProfileUser has 254 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const ProfileUser = () => {
    const dispatch = useAppDispatch();
    const { data, isLoading, error } = useAppSelector((state) => state.profile);
    const [selectedImage, setSelectedImage] = useState<File | null>(null);
    const { showErrorMessage, showSuccessMessage } = useToast();
Severity: Major
Found in src/components/auth/ProfileUser.tsx - About 1 day to fix

    Function PaymentToggleModel has 253 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function PaymentToggleModel() {
        const navigate = useNavigate();
        const dispatch = useAppDispatch();
        const [current, setCurrent] = useState(0);
        const [previousStep, setPreviousStep] = useState(0);
    Severity: Major
    Found in src/components/payment/PaymentToggleModel.tsx - About 1 day to fix

      Function AddEditProductForm has 247 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const AddEditProductForm = () => {
          const location = useLocation();
          const navigate = useNavigate();
          const dispatch = useAppDispatch();
          const { showErrorMessage, showSuccessMessage } = useToast();
      Severity: Major
      Found in src/components/Forms/AddProductForm.tsx - About 1 day to fix

        Function SingleProduct has 245 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const SingleProduct = () => {
            const { isLoading, singleProduct } = useAppSelector((state) => state.product);
        
            const dispatch = useAppDispatch();
            const review = useAppSelector(
        Severity: Major
        Found in src/pages/SingleProduct.tsx - About 1 day to fix

          Function EditUserForm has 217 lines of code (exceeds 25 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: Major
          Found in src/components/Forms/editUserForm.tsx - About 1 day to fix

            Function GetUser has 210 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const GetUser = (props: getUserType) => {
                const [currentPage, setCurrentPage] = useState(0);
                const [searchQuery, setSearchQuery] = useState('');
                const [butOverlay, setButOverlay] = useState('');
                const roles = useAppSelector((state) => state.allRoles?.data[0]);
            Severity: Major
            Found in src/components/adminDashboard/getUser.tsx - About 1 day to fix

              Function ProductsPage has 199 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ProductsPage = () => {
                  const [openFilter, setOpenFilter] = useState(false);
                  const { isLoading, products } = useAppSelector((state) => state.product);
                  const { data, searchInputs } = useAppSelector((state) => state.search);
                  const { carts } = useAppSelector((state) => state.cart);
              Severity: Major
              Found in src/pages/ProductsPage.tsx - About 7 hrs to fix

                Function SellerDashboard has 186 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const SellerDashboard = () => {
                    const dispatch = useAppDispatch();
                    const { show } = useHandleResize();
                    const [VALUES, setVALUES] = useState(initialValues);
                    const { isLoading, allSalesData } = useAppSelector((state) => state.sales);
                Severity: Major
                Found in src/pages/dashboard/seller/SellerDashboard.tsx - About 7 hrs to fix

                  Function AllReview has 185 lines of code (exceeds 25 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: Major
                  Found in src/components/product/review/AllReview.tsx - About 7 hrs to fix

                    Function LandingProduct has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const LandingProduct = () => {
                        const { isLoading, products } = useAppSelector((state) => state.product);
                        const { data, searchInputs } = useAppSelector((state) => state.search);
                        const [openModel, setOpenModel] = useState(false);
                        const [openFilter, setOpenFilter] = useState(false);
                    Severity: Major
                    Found in src/pages/LandingProduct.tsx - About 7 hrs to fix

                      Function Contacts has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const Contacts = () => {
                          const { show } = useHandleResize();
                          const dispatch = useAppDispatch();
                          const { isLoading } = useAppSelector((state) => state.queries);
                          const { showSuccessMessage, showErrorMessage } = useToast();
                      Severity: Major
                      Found in src/pages/Contacts.tsx - About 6 hrs to fix

                        Function ReviewForm has 157 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function ReviewForm(props: reviewFormType) {
                            const [isEditMode, setIsEditMode] = useState(false);
                            const [rated, setRated] = useState(0);
                            const [reviewId, setReviewId] = useState('');
                            const dispatch = useAppDispatch();
                        Severity: Major
                        Found in src/components/Forms/ReviewForm.tsx - About 6 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language