DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

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

>((props: WalletTextInputProps, ref: React.Ref<any>): JSX.Element => {
  const {
    title,
    titleTestID,
    valid = true,
Severity: Minor
Found in mobile-app/app/components/WalletTransactionCardTextInput.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 TransactionError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function TransactionError({
  errMsg,
  onClose,
}: TransactionErrorProps): JSX.Element {
  const logger = useLogger();
Severity: Minor
Found in mobile-app/app/components/OceanInterface/TransactionError.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 SettingsScreen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function SettingsScreen({ navigation }: Props): JSX.Element {
  const logger = useLogger();
  const dispatch = useAppDispatch();
  const walletContext = useWalletPersistenceContext();
  const localAuth = usePrivacyLockContext();
Severity: Minor
Found in mobile-app/app/screens/AppNavigator/screens/Settings/SettingsScreen.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 useTokenPrice has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function useTokenPrice(denominationTokenSymbol = "USDT"): TokenPrice {
  const blockCount = useSelector((state: RootState) => state.block.count);
  const prices = useSelector((state: RootState) =>
    dexPricesSelectorByDenomination(state.wallet, denominationTokenSymbol)
  );

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

function USDValueRow(props: {
  isLoading: boolean;
  testId: string;
  value: BigNumber;
  label: string;

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

export function getActivePrice(
  symbol: string,
  activePrice?: ActivePrice,
  collateralFactor: string = "1",
  priceType: ActivePriceType = "ACTIVE",

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

export function useAuctionTime(
  liquidationHeight: number,
  blockCount: number
): AuctionTimeLeft {
  const { network } = useNetworkContext();

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

export function WithdrawFutureSwapScreen(props: Props): JSX.Element {
  const {
    futureSwap: { source, destination },
    executionBlock,
  } = props.route.params;

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 constructSignedBidAndSend has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  vaultId: PlaceAuctionBid["vaultId"],
  index: PlaceAuctionBid["index"],
  tokenAmount: PlaceAuctionBid["tokenAmount"],
  displaySymbol: string,
  dispatch: Dispatch<any>,

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

    export function NetworkItemRow(props: NetworkItemRowProps): JSX.Element {
      const navigation = useNavigation<NavigationProp<SettingsParamList>>();
      const { network, updateNetwork } = useNetworkContext();
    
      const onPress = async (): Promise<void> => {
    Severity: Minor
    Found in mobile-app/app/components/NetworkItemRow.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 BottomSheetModal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function BottomSheetModal(props: Props): JSX.Element {
      const bottomSheetModalRef = useRef<Modal>(null);
      const { dismiss } = useBottomSheetModal();
      const { isLight } = useThemeContext();
      const {
    Severity: Minor
    Found in mobile-app/app/components/BottomSheetModal.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 NumberRowV2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function NumberRowV2(props: INumberRowProps): JSX.Element {
      return (
        <ThemedViewV2
          style={
            props.containerStyle?.style ??
    Severity: Minor
    Found in mobile-app/app/components/NumberRowV2.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 PoolPairCards has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function PoolPairCards({
      availablePairs,
      onAdd,
      onRemove,
      onSwap,

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

    export function RemoveLiquidityScreen(props: Props): JSX.Element {
      const logger = useLogger();
      const client = useWhaleApiClient();
      const toast = useToast();
      const [fee, setFee] = useState<BigNumber>(new BigNumber(0.0001));
    Severity: Minor
    Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexRemoveLiquidity.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 LoanCards has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function LoanCards(props: LoanCardsProps): JSX.Element {
      const { isLight } = useThemeContext();
      const loanTokens = useSelector((state: RootState) =>
        loanTokensSelector(state.loans)
      );

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

    export function BottomSheetModalV2(props: Props): JSX.Element {
      const bottomSheetModalRef = useRef<Modal>(null);
      const { dismiss } = useBottomSheetModal();
      const { isLight } = useThemeContext();
      const {
    Severity: Minor
    Found in mobile-app/app/components/BottomSheetModalV2.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 ButtonV2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export function ButtonV2(props: ButtonProps): JSX.Element {
      const [buttonState, setButtonState] = useState(ButtonState.default);
    
      useEffect(() => {
        setButtonState(
    Severity: Minor
    Found in mobile-app/app/components/ButtonV2.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 constructSignedSwapAndSend has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      cSwapForm: CompositeSwapForm,
      pairs: PoolPairData[],
      slippage: BigNumber,
      dispatch: Dispatch<any>,
      onBroadcast: () => void,

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

      export function VaultCard(props: VaultCardProps): JSX.Element {
        const navigation = useNavigation<NavigationProp<LoanParamList>>();
        const vault = props.vault as LoanVaultActive;
        const vaultState = useVaultStatus(
          vault.state,

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

      export function AuctionDetailScreen(
        props: BatchDetailScreenProps
      ): JSX.Element {
        const { batch: batchFromParam, vault } = props.route.params;
        const [batch, setBatch] = useState<LoanVaultLiquidationBatch>(batchFromParam);

      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