antoncoding/monarch

View on GitHub

Showing 27 of 95 total issues

Function RebalanceModal has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

export function RebalanceModal({
  groupedPosition,
  isOpen,
  onClose,
  refetch,
Severity: Minor
Found in app/positions/components/RebalanceModal.tsx - About 4 hrs 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 PositionsSummaryTable has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

export function PositionsSummaryTable({
  marketPositions,
  setShowModal,
  setSelectedPosition,
  refetch,
Severity: Minor
Found in app/positions/components/PositionsSummaryTable.tsx - About 4 hrs 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 Markets has 147 lines of code (exceeds 80 allowed). Consider refactoring.
Open

export default function Markets() {
  const { loading, data: rawMarkets } = useMarkets();

  // token keys, aggregated with | for each "ERC20Token" object
  const [selectedCollaterals, setSelectedCollaterals] = useState<string[]>([]);
Severity: Major
Found in app/markets/components/markets.tsx - About 3 hrs to fix

    File FromAndToMarkets.tsx has 317 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React from 'react';
    import { Input } from '@nextui-org/react';
    import { Pagination } from '@nextui-org/react';
    import Image from 'next/image';
    import { formatUnits } from 'viem';
    Severity: Minor
    Found in app/positions/components/FromAndToMarkets.tsx - About 3 hrs to fix

      Function InfoPage has 141 lines of code (exceeds 80 allowed). Consider refactoring.
      Open

      function InfoPage() {
        const [currentSection, setCurrentSection] = useState(0);
        const [isClient, setIsClient] = useState(false);
        const containerRef = useRef<HTMLDivElement>(null);
        const [isTransitioning, setIsTransitioning] = useState(false);
      Severity: Major
      Found in app/info/components/info.tsx - About 3 hrs to fix

        File types.ts has 307 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        export type MarketPosition = {
          supplyShares: string;
          supplyAssets: string;
          supplyAssetsUsd: number;
          borrowShares: string;
        Severity: Minor
        Found in src/utils/types.ts - About 3 hrs to fix

          File PositionsSummaryTable.tsx has 289 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { useMemo, useState, useEffect } from 'react';
          import { Spinner } from '@nextui-org/react';
          import { ChevronDownIcon, ChevronUpIcon } from '@radix-ui/react-icons';
          import Image from 'next/image';
          import { GrRefresh } from 'react-icons/gr';
          Severity: Minor
          Found in app/positions/components/PositionsSummaryTable.tsx - About 2 hrs to fix

            File RebalanceModal.tsx has 267 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { useState, useMemo, useCallback } from 'react';
            import {
              Modal,
              ModalContent,
              ModalHeader,
            Severity: Minor
            Found in app/positions/components/RebalanceModal.tsx - About 2 hrs to fix

              Function Input has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function Input({
                decimals,
                max,
                setValue,
                setError,
              Severity: Minor
              Found in src/components/Input/Input.tsx - About 2 hrs 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 useUserPositions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              const useUserPositions = (user: string | undefined) => {
                const [loading, setLoading] = useState(true);
                const [isRefetching, setIsRefetching] = useState(false);
                const [data, setData] = useState<MarketPosition[]>([]);
                const [history, setHistory] = useState<UserTransaction[]>([]);
              Severity: Minor
              Found in src/hooks/useUserPositions.ts - 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 InfoPage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function InfoPage() {
                const [currentSection, setCurrentSection] = useState(0);
                const [isClient, setIsClient] = useState(false);
                const containerRef = useRef<HTMLDivElement>(null);
                const [isTransitioning, setIsTransitioning] = useState(false);
              Severity: Minor
              Found in app/info/components/info.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 WithdrawModal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              export function WithdrawModal({ position, onClose, refetch }: ModalProps): JSX.Element {
                // Add state for the supply amount
                const [inputError, setInputError] = useState<string | null>(null);
                const [withdrawAmount, setWithdrawAmount] = useState<bigint>(BigInt(0));
              
              
              Severity: Minor
              Found in app/positions/components/withdrawModal.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 useUserPositions has 84 lines of code (exceeds 80 allowed). Consider refactoring.
              Open

              const useUserPositions = (user: string | undefined) => {
                const [loading, setLoading] = useState(true);
                const [isRefetching, setIsRefetching] = useState(false);
                const [data, setData] = useState<MarketPosition[]>([]);
                const [history, setHistory] = useState<UserTransaction[]>([]);
              Severity: Major
              Found in src/hooks/useUserPositions.ts - About 1 hr to fix

                Function AssetFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function AssetFilter({
                  label,
                  placeholder,
                  selectedAssets,
                  setSelectedAssets,
                Severity: Minor
                Found in app/markets/components/AssetFilter.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 useMarkets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                const useMarkets = () => {
                  const [loading, setLoading] = useState(true);
                  const [isRefetching, setIsRefetching] = useState(false);
                  const [data, setData] = useState<Market[]>([]);
                  const [error, setError] = useState<unknown | null>(null);
                Severity: Minor
                Found in src/hooks/useMarkets.ts - 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 useMarkets has 82 lines of code (exceeds 80 allowed). Consider refactoring.
                Open

                const useMarkets = () => {
                  const [loading, setLoading] = useState(true);
                  const [isRefetching, setIsRefetching] = useState(false);
                  const [data, setData] = useState<Market[]>([]);
                  const [error, setError] = useState<unknown | null>(null);
                Severity: Major
                Found in src/hooks/useMarkets.ts - About 1 hr to fix

                  Function Rewards has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function Rewards() {
                    const { account } = useParams<{ account: string }>();
                    const [activeProgram, setActiveProgram] = useState<'market' | 'uniform'>('market');
                  
                    const { loading, data: markets } = useMarkets();
                  Severity: Minor
                  Found in app/rewards/components/RewardContent.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 useAllowance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function useAllowance({
                    user,
                    spender,
                    chainId = 1,
                    token,
                  Severity: Minor
                  Found in src/hooks/useAllowance.ts - 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 Button has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function Button({
                    buttonContent,
                    type = 'button',
                    className,
                    onClick,
                  Severity: Minor
                  Found in src/components/Button/Button.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 OracleVendorBadge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function OracleVendorBadge({ oracleData, useTooltip = true }: OracleVendorBadgeProps) {
                    const { vendors } = parseOracleVendors(oracleData);
                  
                    const noFeeds = vendors.length === 0;
                  
                  
                  Severity: Minor
                  Found in src/components/OracleVendorBadge.tsx - About 35 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