Showing 335 of 335 total issues
File DexConfirmAddLiquidity.tsx
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { WalletAlert } from "@components/WalletAlert";
import { CTransactionSegWit } from "@defichain/jellyfish-transaction";
import { WhaleWalletAccount } from "@defichain/whale-api-wallet";
import { NavigationProp, useNavigation } from "@react-navigation/native";
import { StackScreenProps } from "@react-navigation/stack";
Function OceanInterface
has 209 lines of code (exceeds 100 allowed). Consider refactoring. Open
export function OceanInterface(): JSX.Element | null {
const logger = useLogger();
const dispatch = useAppDispatch();
const client = useWhaleApiClient();
const { wallet, address } = useWalletContext();
File CFPDetailScreen.tsx
has 383 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useCallback, useEffect, useMemo, useState } from "react";
import { translate } from "@translations";
import { ThemedTextV2 } from "@components/themed";
import { tailwind } from "@tailwind";
import { ProposalURLInput } from "@screens/AppNavigator/screens/Portfolio/components/ProposalURLInput";
File VaultDetailScreen.tsx
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ThemedScrollViewV2 } from "@components/themed";
import { StackScreenProps } from "@react-navigation/stack";
import { tailwind } from "@tailwind";
import { useEffect, useState } from "react";
import { Platform, View } from "react-native";
File AddressRow.tsx
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { View } from "react-native";
import { tailwind } from "@tailwind";
import { translate } from "@translations";
import { AddressType } from "@waveshq/walletkit-ui/dist/store";
import {
File Announcements.tsx
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ThemedIcon,
ThemedProps,
ThemedText,
ThemedTextV2,
File WithdrawFutureSwapScreen.tsx
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useEffect, useMemo, useState } from "react";
import BigNumber from "bignumber.js";
import { StackScreenProps } from "@react-navigation/stack";
import { tailwind } from "@tailwind";
import { translate } from "@translations";
File ConfirmEditLoanSchemeScreen.tsx
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ThemedScrollViewV2,
ThemedTextV2,
ThemedViewV2,
} from "@components/themed";
File SettingsScreen.tsx
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ThemedIcon,
ThemedScrollViewV2,
ThemedSectionTitleV2,
ThemedTextV2,
File AuctionDetailScreen.tsx
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useState, useEffect } from "react";
import { View } from "react-native";
import { useSelector, batch as reduxBatch } from "react-redux";
import { NumericFormat as NumberFormat } from "react-number-format";
import BigNumber from "bignumber.js";
File ConfirmPaybackLoanScreen.tsx
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { View } from "react-native";
import {
ThemedScrollViewV2,
ThemedTextV2,
ThemedViewV2,
Function ActionButtons
has 194 lines of code (exceeds 100 allowed). Consider refactoring. Open
export function ActionButtons(): JSX.Element {
const { isFeatureAvailable } = useFeatureFlagContext();
const { domain, isEvmFeatureEnabled } = useDomainContext();
const isEvmDomain = domain === DomainType.EVM;
Function CreateOrEditAddressLabelForm
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
({ route, navigation }: Props): JSX.Element => {
const { title, address, addressLabel, onSaveButtonPress } = route.params;
const { isLight } = useThemeContext();
const { domain } = useDomainContext();
const { account } = useWalletContext();
- 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
File TokenSelectionScreen.tsx
has 364 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { useRef, useState, useMemo } from "react";
import { Image } from "expo-image";
import { View, TextInput } from "react-native";
import { NumericFormat as NumberFormat } from "react-number-format";
import { useSelector } from "react-redux";
File GetDFIScreen.tsx
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as Clipboard from "expo-clipboard";
import { StackScreenProps } from "@react-navigation/stack";
import { useCallback, useEffect, useState } from "react";
import { Share, TouchableOpacity, View, Text } from "react-native";
import QRCode from "react-qr-code";
File VaultDetailCollateralsRow.tsx
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BigNumber from "bignumber.js";
import { useEffect, useState } from "react";
import { ThemedIcon, ThemedTextV2, ThemedViewV2 } from "@components/themed";
import { tailwind } from "@tailwind";
import { View } from "@components";
Similar blocks of code found in 2 locations. Consider refactoring. Open
<ThemedViewV2
dark={tailwind("border-mono-dark-v2-200")}
light={tailwind("border-mono-light-v2-200")}
style={tailwind("py-5 border-t-0.5")}
>
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 255.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
<ThemedViewV2
dark={tailwind("border-mono-dark-v2-200")}
light={tailwind("border-mono-light-v2-200")}
style={tailwind("py-5 border-t-0.5")}
>
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 255.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function PrivacyLockContextProvider
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export function PrivacyLockContextProvider(
props: React.PropsWithChildren<any>
): JSX.Element | null {
const logger = useLogger();
const [hasHardware, setHasHardware] = useState<boolean>(false);
- 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
File ViewPoolDetails.tsx
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { View, Platform } from "react-native";
import { memo } from "react";
import { tailwind } from "@tailwind";
import BigNumber from "bignumber.js";
import { ThemedTextV2, ThemedViewV2 } from "@components/themed";