Showing 88 of 262 total issues
Function UpdatePassword
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
const UpdatePassword = () => {
const dispatch = useAppDispatch();
const { showErrorMessage, showSuccessMessage } = useToast();
const { isLoading, error } = useAppSelector((state) => state.updatePassword);
const { data } = useAppSelector((state) => state.profile);
Function CategoriesPage
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CategoriesPage = () => {
const [categoryData, setCategoryData] = useState<categorySchemaType | null>(
null,
);
const { isLoading, categories, isCategoryModelOpen } = useAppSelector(
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">
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);
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);
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') || '';
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');
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();
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);
- Read upRead up
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();
Function SalesPage
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SalesPage = () => {
const dispatch = useAppDispatch();
const {
isLoading,
allSalesData: sales,
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 => {
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,
);
- Read upRead up
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 SingleSale
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
const SingleSale: React.FC = () => {
const dispatch = useAppDispatch();
const { singleSaleData: sale, isLoading } = useAppSelector(
(state: RootState) => state.sales,
);
Function ResetPasswordForm
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ResetPasswordForm = () => {
const [searchParams] = useSearchParams();
const token = searchParams.get('token');
const { isLoading } = useAppSelector((state) => state.resetPassword);
Function SingleProduct
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const SingleProduct = () => {
const { isLoading, singleProduct } = useAppSelector((state) => state.product);
const dispatch = useAppDispatch();
const review = useAppSelector(
- Read upRead up
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 RatingModel
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function RatingModel() {
const data = useAppSelector(
(state) => state.fetchReview.data[state.fetchReview.data.length - 1]?.data,
);
Function updateChart
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateChart = () => {
if (allSalesData.length > 0) {
chartData.forEach((monthData) => {
monthData.approvals = 0;
monthData.rejected = 0;
File PaymentToggleModel.tsx
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable prefer-const */
import { useEffect, useState } from 'react';
import momoIcon from '../../assets/momo.png';
import PaymentButton from '../buttons/PaymentButton';
import { useAppSelector, useAppDispatch } from '../../redux/hooks/hooks';
File ProfileUser.tsx
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useEffect, useState } from 'react';
import { zodResolver } from '@hookform/resolvers/zod';
import { SubmitHandler, useForm, useWatch } from 'react-hook-form';
import Upload from '../../assets/upload.svg';
import FormInput from '../Forms/InputText';