Showing 286 of 335 total issues
Function TokenDetailScreen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function TokenDetailScreen({ route, navigation }: Props): JSX.Element {
const { denominationCurrency } = useDenominationCurrency();
const { domain } = useDomainContext();
const { hasFetchedToken } = useSelector((state: RootState) => state.wallet);
- 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 secondsToDhmsDisplay
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function secondsToDhmsDisplay(seconds: number): string {
const { d, h, m, s } = secondsToDhm(seconds);
const dDisplay =
d > 0 ? translate("components/BatchCard", " {{d}}d", { d }) : "";
const hDisplay =
- 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 ConfirmPlaceBidScreen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function ConfirmPlaceBidScreen(props: Props): JSX.Element {
const navigation = useNavigation<NavigationProp<AuctionsParamList>>();
const dispatch = useAppDispatch();
const logger = useLogger();
const hasPendingJob = useSelector((state: RootState) =>
- 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 TransactionDetailsSection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function TransactionDetailsSection(
props: TransactionDetailsProps,
): JSX.Element {
const isEmptyBorrowAmount =
new BigNumber(props.borrowAmount).isNaN() ||
- 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 TokenSelectionScreen
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function TokenSelectionScreen(): JSX.Element {
const { isLight } = useThemeContext();
const { domain } = useDomainContext();
const navigation = useNavigation<NavigationProp<PortfolioParamList>>();
const tokens = useSelector((state: RootState) =>
- 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
Consider simplifying this complex logical expression. Open
if (
selectedPoolPairs === undefined ||
selectedTokenA === undefined ||
selectedTokenB === undefined ||
priceRates === undefined ||
Consider simplifying this complex logical expression. Open
if (
tx?.broadcasted && // only call tx when tx is done
calledTx !== tx?.tx.txId && // to ensure that api is only called once per tx
tx?.tx.txId !== undefined &&
network === EnvironmentNetwork.MainNet &&
Consider simplifying this complex logical expression. Open
if (
(!hasDUSDLoan && isDFILessThanHalfOfRequiredCollateral) ||
(isFeatureAvailable("loop_dusd") &&
hasDUSDLoan &&
isDFILessThanHalfOfRequiredCollateral &&
Consider simplifying this complex logical expression. Open
if (
((Platform.OS !== "ios" &&
Platform.OS !== "android" &&
announcement.type !== "SCAN") ||
satisfies(version, announcement.version)) &&
Function useVaultStatus
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
status: LoanVaultState | undefined,
collateralRatio: BigNumber,
minColRatio: BigNumber,
totalLoanAmount: BigNumber,
totalCollateralValue: BigNumber
Function createVault
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
{ loanScheme }: VaultForm,
dispatch: Dispatch<any>,
onBroadcast: () => void,
onConfirmation: () => void,
logger: NativeLoggingProps,
Function useResultingCollateralRatio
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
collateralValue: BigNumber,
existingLoanValue: BigNumber,
newLoanAmount: BigNumber,
activePrice: BigNumber,
interestPerBlock: BigNumber
Function borrowLoanToken
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
{ vaultId, borrowAmount, loanToken }: BorrowForm,
dispatch: Dispatch<any>,
onBroadcast: () => void,
onConfirmation: () => void,
logger: NativeLoggingProps
Function closeVault
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
vaultId: string,
dispatch: Dispatch<any>,
onBroadcast: () => void,
onConfirmation: () => void,
logger: NativeLoggingProps
Function queueConvertTransaction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
{ mode, amount }: { mode: ConvertDirection; amount: BigNumber },
dispatch: Dispatch<any>,
onBroadcast: () => void,
logger: NativeLoggingProps,
onConfirmation: () => void = () => {},
Function canAddLiquidity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
pair: ExtPoolPairData,
tokenAAmount: BigNumber,
tokenBAmount: BigNumber,
balanceA: BigNumber | undefined,
balanceB: BigNumber | undefined,
Function useValidCollateralRatio
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
collateralAmounts: LoanVaultTokenAmount[],
totalCollateralVaultValue: BigNumber,
loanValue: BigNumber,
collateralTokenId?: string,
updatedCollateralAmount?: BigNumber
Function authenticateFor
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
promptPassphrase: () => Promise<string>,
authentication: Authentication<T>,
onAutoRetry: (attempts: number) => Promise<void>,
retries: number = 0,
logger: NativeLoggingProps
Function modifyCollateral
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
{ vaultId, tokenAmount, token, isAdd }: ModifyCollateralForm,
dispatch: Dispatch<any>,
logger: NativeLoggingProps,
onBroadcast: () => void,
onConfirmation: () => void
Function signTransaction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
tx: DfTxSigner,
account: WhaleWalletAccount,
onAutoRetry: (attempts: number) => Promise<void>,
retries: number = 0,
logger: NativeLoggingProps