Showing 335 of 335 total issues
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)
);
- 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 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 ??
- 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 constructSignedSwapAndSend
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
cSwapForm: CompositeSwapForm,
pairs: PoolPairData[],
slippage: BigNumber,
dispatch: Dispatch<any>,
onBroadcast: () => void,
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));
- 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 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,
- 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 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> => {
- 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 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(
- 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 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 {
- 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 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 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
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);
- 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 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
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 (
selectedPoolPairs === undefined ||
selectedTokenA === undefined ||
selectedTokenB === undefined ||
priceRates === undefined ||
Consider simplifying this complex logical expression. Open
if (
((Platform.OS !== "ios" &&
Platform.OS !== "android" &&
announcement.type !== "SCAN") ||
satisfies(version, announcement.version)) &&
Consider simplifying this complex logical expression. Open
if (
(!hasDUSDLoan && isDFILessThanHalfOfRequiredCollateral) ||
(isFeatureAvailable("loop_dusd") &&
hasDUSDLoan &&
isDFILessThanHalfOfRequiredCollateral &&
Function useResultingCollateralRatio
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
collateralValue: BigNumber,
existingLoanValue: BigNumber,
newLoanAmount: BigNumber,
activePrice: BigNumber,
interestPerBlock: BigNumber
Function useVaultStatus
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
status: LoanVaultState | undefined,
collateralRatio: BigNumber,
minColRatio: BigNumber,
totalLoanAmount: BigNumber,
totalCollateralValue: BigNumber