atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 262 of 262 total issues

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

            <td className="w-20 h-16">
                <img
                    src={sale.soldProducts.images[0]}
                    alt=""
                    className="w-full h-full object-cover rounded-lg"
Severity: Major
Found in src/pages/dashboard/seller/Sales/SalesTableRows.tsx and 2 other locations - About 55 mins to fix
src/pages/dashboard/buyer/order/SingleOrders.tsx on lines 111..117
src/pages/dashboard/seller/wishlist/WishTableRow.tsx on lines 21..27

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

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=" ">
                                                    <img
                                                        src={sale.soldProducts.images[0]}
                                                        alt="image"
                                                        className="rounded-lg w-full h-48 tablet:w-60 tablet:h-50 object-cover"
Severity: Major
Found in src/pages/dashboard/buyer/order/SingleOrders.tsx and 2 other locations - About 55 mins to fix
src/pages/dashboard/seller/Sales/SalesTableRows.tsx on lines 51..57
src/pages/dashboard/seller/wishlist/WishTableRow.tsx on lines 21..27

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

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

            <td className="w-20 h-16">
                <img
                    src={wishes.product.images[0]}
                    alt="product_images"
                    className="w-full h-full object-cover rounded-lg"
Severity: Major
Found in src/pages/dashboard/seller/wishlist/WishTableRow.tsx and 2 other locations - About 55 mins to fix
src/pages/dashboard/buyer/order/SingleOrders.tsx on lines 111..117
src/pages/dashboard/seller/Sales/SalesTableRows.tsx on lines 51..57

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

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

    const {
        register,
        handleSubmit,
        reset,
        formState: { errors },
Severity: Major
Found in src/pages/Contacts.tsx and 2 other locations - About 55 mins to fix
src/components/Forms/ReviewForm.tsx on lines 29..36
src/components/Layouts/UpdatePassword.tsx on lines 26..33

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

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 PreventSeller has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PreventSeller = ({ roles }: { roles: Array<string> }) => {
    const navigate = useNavigate();
    const { showErrorMessage } = useToast();
    const decoded = fetchInfo() as UserInfoTypes;
    const [isAuthorized, setIsAuthorized] = useState(false);
Severity: Minor
Found in src/components/Layouts/PreventSeller.tsx - About 55 mins 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 CartQuantity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const CartQuantity = ({ productId }: CartQuantityProps) => {
    const { showErrorMessage } = useToast();
    const dispatch = useAppDispatch();
    const { carts } = useAppSelector((state) => state.cart);
    const [quantity, setQuantity] = useState<number>(0);
Severity: Minor
Found in src/components/buttons/CartQuantity.tsx - About 55 mins 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 NotificationItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const NotificationItem = ({
    text,
    date,
    unread,
    id,
Severity: Minor
Found in src/components/cards/NotificationItem.tsx - About 55 mins 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

export const EnableDisableSchema = z.object({
    reason: z
        .string({ message: 'Reason must be a string' })
        .nonempty({ message: 'Reason field is required' }),
});
Severity: Minor
Found in src/validations/EnableDisable.validation.ts and 1 other location - About 50 mins to fix
src/validations/updatUserRoleValidations.ts on lines 3..9

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

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

export const updateUserRoleSchema = z.object({
    role: z
        .string({
            message: 'role must be a string',
        })
Severity: Minor
Found in src/validations/updatUserRoleValidations.ts and 1 other location - About 50 mins to fix
src/validations/EnableDisable.validation.ts on lines 3..7

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

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

                    <div className="flex items-center justify-center">
                        <Pagination
                            data-testid="pagination-component"
                            pageCount={pageCount}
                            currentPage={currentPage}
Severity: Minor
Found in src/pages/Admin/Querries.tsx and 1 other location - About 50 mins to fix
src/pages/dashboard/seller/Sales/SalesPage.tsx on lines 88..95

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

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

                    <div className="flex items-center justify-center">
                        <Pagination
                            data-testid="pagination-component"
                            pageCount={pageCount}
                            currentPage={currentPage}
Severity: Minor
Found in src/pages/dashboard/seller/Sales/SalesPage.tsx and 1 other location - About 50 mins to fix
src/pages/Admin/Querries.tsx on lines 91..98

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

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 getStatusColor = (status: string) => {
    switch (status.toLowerCase()) {
        case 'canceled':
            return 'text-action-error font-medium';
        case 'delivered':
Severity: Minor
Found in src/utils/statusColor.ts and 1 other location - About 50 mins to fix
src/utils/ColorChange.ts on lines 1..11

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

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

export const getStatusClass = (status: string) => {
    switch (status.toLowerCase()) {
        case 'canceled':
            return 'text-red-500';
        case 'delivered':
Severity: Minor
Found in src/utils/ColorChange.ts and 1 other location - About 50 mins to fix
src/utils/statusColor.ts on lines 1..11

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

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

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

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

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

Refactorings

Further Reading

Function Notification has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const Notification = () => {
    const dispatch = useAppDispatch();
    const { accessToken } = useToken();
    const notificationPlayer = useRef<HTMLAudioElement>(null);
    const [notificationActive, setNotificationActive] = useState(false);
Severity: Minor
Found in src/components/notification/Notification.tsx - About 45 mins 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 SellerSingleProduct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const SellerSingleProduct = () => {
    const { id } = useParams();
    const { isLoading, singleProduct } = useAppSelector((state) => state.product);
    const { availability } = useAppSelector((state) => state.productAvailability);
    const dispatch = useAppDispatch();
Severity: Minor
Found in src/pages/dashboard/seller/SellerSingleProduct.tsx - About 45 mins 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 ProductsPage has a Cognitive Complexity of 8 (exceeds 5 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: Minor
Found in src/pages/ProductsPage.tsx - About 45 mins 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 7 locations. Consider refactoring.
Open

    const {
        register,
        handleSubmit,
        formState: { errors },
    } = useForm<LoginSchemaType>({ resolver: zodResolver(LoginSchema) });
Severity: Major
Found in src/components/auth/LoginForm.tsx and 6 other locations - About 40 mins to fix
src/components/Forms/editUserForm.tsx on lines 63..69
src/components/Forms/editUserForm.tsx on lines 92..98
src/components/ResetPassword/ResetPasswordForm.tsx on lines 28..34
src/components/auth/RegisterForm.tsx on lines 27..31
src/components/forgottonPassword/ForgottonPasswordForm.tsx on lines 23..29
src/pages/auth/TwoFactor.tsx on lines 27..31

Duplicated Code

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

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

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

Tuning

This issue has a mass of 49.

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

    const {
        register,
        handleSubmit,
        formState: { errors },
    } = useForm<updateUserRoleSchemaType>({
Severity: Major
Found in src/components/Forms/editUserForm.tsx and 6 other locations - About 40 mins to fix
src/components/Forms/editUserForm.tsx on lines 92..98
src/components/ResetPassword/ResetPasswordForm.tsx on lines 28..34
src/components/auth/LoginForm.tsx on lines 30..34
src/components/auth/RegisterForm.tsx on lines 27..31
src/components/forgottonPassword/ForgottonPasswordForm.tsx on lines 23..29
src/pages/auth/TwoFactor.tsx on lines 27..31

Duplicated Code

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

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

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

Tuning

This issue has a mass of 49.

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

    const {
        register,
        handleSubmit,
        formState: { errors },
    } = useForm<OTPSchemaType>({ resolver: zodResolver(OTPSchema) });
Severity: Major
Found in src/pages/auth/TwoFactor.tsx and 6 other locations - About 40 mins to fix
src/components/Forms/editUserForm.tsx on lines 63..69
src/components/Forms/editUserForm.tsx on lines 92..98
src/components/ResetPassword/ResetPasswordForm.tsx on lines 28..34
src/components/auth/LoginForm.tsx on lines 30..34
src/components/auth/RegisterForm.tsx on lines 27..31
src/components/forgottonPassword/ForgottonPasswordForm.tsx on lines 23..29

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

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={`wave -one waves-floating ${background}`}
                    style={{
                        bottom: `${percentage(percent)}%`,
                    }}
Severity: Major
Found in src/components/cards/WaterPercentCard.tsx and 2 other locations - About 40 mins to fix
src/components/cards/WaterPercentCard.tsx on lines 25..30
src/components/cards/WaterPercentCard.tsx on lines 31..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 49.

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