atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

Function VerifiedCard has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const VerifiedCard = () => {
    const { isLoading, isVerified, message } = useAppSelector(
        (state) => state.verifyAccount,
    );
    return (
Severity: Minor
Found in src/components/cards/VerifiedCard.tsx - About 1 hr 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 UpdateOrderModal has a Cognitive Complexity of 13 (exceeds 5 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: Minor
Found in src/pages/dashboard/seller/Sales/UpdateOrderModal.tsx - About 1 hr 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

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

            {
                label: 'Approved',
                data: chartData.map((data) => data.approvals),
                backgroundColor: ['rgb(38, 100, 145, 1)'],
                borderColor: 'rgb(38, 100, 145)"',
Severity: Major
Found in src/components/cards/SellerBarChart.tsx and 1 other location - About 1 hr to fix
src/components/cards/SellerBarChart.tsx on lines 38..49

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

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

            {
                label: 'Rejected',
                data: chartData.map((data) => data.rejected),
                backgroundColor: ['#660b0b'],
                borderColor: '#660b0b',
Severity: Major
Found in src/components/cards/SellerBarChart.tsx and 1 other location - About 1 hr to fix
src/components/cards/SellerBarChart.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 66.

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

    if (isLoading || processing) {
        return (
            <div className="flex-1 h-full flex-center flex-col gap-4">
                <HashLoader color="#266491" size={60} role="progressbar" />
                <p className="text-xs">Please wait ...</p>
Severity: Major
Found in src/pages/dashboard/seller/SellerDashboard.tsx and 1 other location - About 1 hr to fix
src/components/Forms/AddProductForm.tsx on lines 116..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 66.

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

    if (isLoading) {
        return (
            <div className="flex-1 h-full flex-center flex-col gap-4">
                <HashLoader color="#266491" size={60} role="progressbar" />
                <p className="text-xs">Please wait ...</p>
Severity: Major
Found in src/components/Forms/AddProductForm.tsx and 1 other location - About 1 hr to fix
src/pages/dashboard/seller/SellerDashboard.tsx on lines 140..147

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

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

const WishlistPage = () => {
    const dispatch = useAppDispatch();
    const { isLoading, wishlist } = useAppSelector((state) => state.sellerWishes);

    useEffect(() => {
Severity: Minor
Found in src/pages/dashboard/seller/wishlist/wishlistPage.tsx - About 1 hr to fix

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

                            <label className="flex flex-col font-semibold gap-3">
                                First Name:
                                <FormInput
                                    type="text"
                                    placeholder="Ivy"
    Severity: Major
    Found in src/components/auth/ProfileUser.tsx and 1 other location - About 1 hr to fix
    src/components/auth/ProfileUser.tsx on lines 137..148

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

    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

                            <label className="flex flex-col font-semibold gap-3">
                                Last Name:
                                <FormInput
                                    type="text"
                                    placeholder="Jacky"
    Severity: Major
    Found in src/components/auth/ProfileUser.tsx and 1 other location - About 1 hr to fix
    src/components/auth/ProfileUser.tsx on lines 125..136

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

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

    const ChatComponent = () => {
        const [chatModal, setChatModal] = useState(false);
        const toggleChatModal = () => {
            setChatModal(!chatModal);
        };
    Severity: Minor
    Found in src/components/chat/ChatComponent.tsx - About 1 hr to fix

      Function LogoutCard has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const LogoutCard = () => {
          const dispatch = useAppDispatch();
          const { isLoading } = useAppSelector((state) => state.logout);
          const { showErrorMessage, showWorningMessage } = useToast();
      
      
      Severity: Minor
      Found in src/components/cards/LogoutCard.tsx - About 1 hr to fix

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

                        <div className="view_product flex gap-2 text-sm rounded-md p-1 a_link">
                            <Link to={`/dashboard/products/${id}`} className="flex gap-2">
                                <ShoppingBasket className="text-sm" /> Preview
                            </Link>
                        </div>
        Severity: Major
        Found in src/components/cards/SellerProductsModal.tsx and 1 other location - About 1 hr to fix
        src/components/cards/orderModel.tsx on lines 18..22

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

        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="view_product flex justify-center gap-2 text-sm rounded-md p-1 a_link mt-5 mb-3">
                            <Link to={`/orders/${id}`} className="flex items-center gap-2">
                                <ShoppingBasket className="text-sm text-center" /> View More
                            </Link>
                        </div>
        Severity: Major
        Found in src/components/cards/orderModel.tsx and 1 other location - About 1 hr to fix
        src/components/cards/SellerProductsModal.tsx on lines 33..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 64.

        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 LandingProduct has a Cognitive Complexity of 12 (exceeds 5 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: Minor
        Found in src/pages/LandingProduct.tsx - About 1 hr 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 LoginForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        const LoginForm = () => {
            const { isLoading } = useAppSelector((state) => state.login);
            const { showErrorMessage, showSuccessMessage } = useToast();
            const { saveAccessToken } = useToken();
            const { show } = useHandleResize();
        Severity: Minor
        Found in src/components/auth/LoginForm.tsx - About 1 hr 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 ReviewForm has a Cognitive Complexity of 12 (exceeds 5 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: Minor
        Found in src/components/Forms/ReviewForm.tsx - About 1 hr 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 AddEditProductForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        const AddEditProductForm = () => {
            const location = useLocation();
            const navigate = useNavigate();
            const dispatch = useAppDispatch();
            const { showErrorMessage, showSuccessMessage } = useToast();
        Severity: Minor
        Found in src/components/Forms/AddProductForm.tsx - About 1 hr 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

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

                        <Button
                            url={null}
                            buttonType="submit"
                            title={
                                isLoading ? (
        Severity: Major
        Found in src/components/auth/LoginForm.tsx and 1 other location - About 1 hr to fix
        src/components/auth/RegisterForm.tsx on lines 107..121

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

        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

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

                                        <motion.form
                                            initial={{ y: '100%', opacity: 1 }}
                                            animate={{ y: '0%' }}
                                            transition={{ ease: 'easeOut', duration: 1 }}
                                            className=" flex w-full gap-5 py-3"
        Severity: Major
        Found in src/pages/LandingProduct.tsx and 1 other location - About 1 hr to fix
        src/pages/ProductsPage.tsx on lines 132..160

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

        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

                        <Button
                            url={null}
                            buttonType="submit"
                            title={
                                isLoading ? (
        Severity: Major
        Found in src/components/auth/RegisterForm.tsx and 1 other location - About 1 hr to fix
        src/components/auth/LoginForm.tsx on lines 97..111

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

        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