atlp-rwanda/hackers-ec-Fe

View on GitHub

Showing 88 of 262 total issues

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

    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

    Function UserProfileSideBox has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function UserProfileSideBox() {
        const location = useLocation();
        const [active, setActive] = useState(location.pathname);
    
        const handleClick = (path: string) => {
    Severity: Minor
    Found in src/components/UserProfileSideBox.tsx - About 1 hr to fix

      Function GetUser has a Cognitive Complexity of 11 (exceeds 5 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: Minor
      Found in src/components/adminDashboard/getUser.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 DeleteProduct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      const DeleteProduct = ({ item }: DeleteModalProps) => {
          const { isLoading: processing } = useAppSelector(
              (state) => state.deleteProduct,
          );
      
      
      Severity: Minor
      Found in src/components/cards/DeleteProduct.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 CategoriesForm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      const CategoriesForm: React.FC<CategoriesFormProps> = ({
          categoryData,
          onClose,
      }) => {
          const { showErrorMessage, showSuccessMessage } = useToast();
      Severity: Minor
      Found in src/pages/dashboard/seller/categories/CategoriesForm.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 PaymentSuccess has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function PaymentSuccess() {
          const [searchParams] = useSearchParams();
          const sessionId = searchParams.get('sessionId')!;
          const payerId = searchParams.get('payerId')!;
          const dispatch = useAppDispatch();
      Severity: Minor
      Found in src/pages/PaymentSuccess.tsx - About 1 hr to fix

        Function onSubmit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const onSubmit: SubmitHandler<UpdateOrderFormValues> = async (data) => {
                try {
                    const resultAction = await dispatch(
                        updateOrder({
                            id: selectedSaleId ?? '',
        Severity: Minor
        Found in src/pages/dashboard/seller/Sales/UpdateOrderModal.tsx - About 1 hr to fix

          Function HandleGoogleLogin has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const HandleGoogleLogin = () => {
              const [searchParams] = useSearchParams();
              const token = searchParams.get('token');
              const message = searchParams.get('message');
              const { saveAccessToken } = useToken();
          Severity: Minor
          Found in src/components/HandleGoogleLogin.tsx - About 1 hr to fix

            Function ChatRedirections has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ChatRedirections = () => {
                return (
                    <AnimatePresence>
                        <motion.div
                            className="parent fixed inset-0 w-full h-full bg-neutr backdrop-blur-sm z-30
            Severity: Minor
            Found in src/components/Redirection/ChatRedirections.tsx - About 1 hr to fix

              Function onSubmit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const onSubmit: SubmitHandler<reviewFormSchemaType> = async (
                      data: reviewFormSchemaType,
                  ) => {
                      try {
                          const { ratings, feedBack } = data;
              Severity: Minor
              Found in src/components/Forms/ReviewForm.tsx - About 1 hr to fix

                Function onSubmit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    const onSubmit: SubmitHandler<queryTypes> = async (formData: queryTypes) => {
                        try {
                            const data = await dispatch(
                                sendQuery({
                                    lastName: formData.lastName,
                Severity: Minor
                Found in src/pages/Contacts.tsx - About 1 hr to fix

                  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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language