DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

Function RemoveLiquidityConfirmScreen has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function RemoveLiquidityConfirmScreen({ route }: Props): JSX.Element {
  const {
    pair,
    pairInfo,
    amount,

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

export function useValidCollateralRatio(
  collateralAmounts: LoanVaultTokenAmount[],
  totalCollateralVaultValue: BigNumber,
  loanValue: BigNumber,
  collateralTokenId?: 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 BrowseAuctions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function BrowseAuctions({
  batches,
  filteredAuctionBatches,
  showSearchInput,
  searchString,

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

function ActionButton(props: ActionButtonsProps): JSX.Element {
  const DFIIcon = getNativeIcon("DFIlogo");
  const { isLight } = useThemeContext();
  return (
    <View style={tailwind("items-center")}>

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 FeatureFlagProvider has 104 lines of code (exceeds 100 allowed). Consider refactoring.
Open

export function FeatureFlagProvider(
  props: React.PropsWithChildren<any>,
): JSX.Element | null {
  const { network } = useNetworkContext();
  const { url, isCustomUrl } = useServiceProviderContext();
Severity: Major
Found in mobile-app/app/contexts/FeatureFlagContext.tsx - About 1 hr to fix

    Function BottomSheetModal has 104 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

    export function BottomSheetModal(props: Props): JSX.Element {
      const bottomSheetModalRef = useRef<Modal>(null);
      const { dismiss } = useBottomSheetModal();
      const { isLight } = useThemeContext();
      const {
    Severity: Major
    Found in mobile-app/app/components/BottomSheetModal.tsx - About 1 hr to fix

      Function CollateralizationRatioDisplay has 103 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function CollateralizationRatioDisplay(
        props: CollateralizationRatioDisplayProps
      ): JSX.Element {
        const { isLight } = useThemeContext();
        const atRiskThresholdMultiplier = 1.5;

        Function StepTwo has 103 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        function StepTwo(): JSX.Element {
          const logger = useLogger();
          const { isLight } = useThemeContext();
          const { address } = useWalletContext();
          const [showToast, setShowToast] = useState(false);

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

          export function ThemedIcon(props: ThemedIconProps): JSX.Element {
            const { isLight } = useThemeContext();
            const {
              style,
              iconType,
          Severity: Minor
          Found in mobile-app/app/components/themed/ThemedIcon.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 PlaygroundStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export function PlaygroundStatus({
            online,
            error,
            loading,
            offline,

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

          export function PinConfirmation({ route }: Props): JSX.Element {
            const navigation = useNavigation<NavigationProp<WalletParamList>>();
            const logger = useLogger();
            const [isComplete, setIsComplete] = useState<boolean>(false); // To complete the last stepper node when pin is verified.
            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 SubmitButtonGroup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export function SubmitButtonGroup({
            buttonStyle,
            isDisabled,
            isCancelDisabled,
            displayCancelBtn,
          Severity: Minor
          Found in mobile-app/app/components/SubmitButtonGroup.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 FeatureFlagScreen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export function FeatureFlagScreen(): JSX.Element {
            const { featureFlags, enabledFeatures, updateEnabledFeatures } =
              useFeatureFlagContext();
            const [betaFeatures, setBetaFeatures] = useState<BetaFeaturesI[]>([]);
          
          

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

          function TokenSummary(props: {
            token: WalletToken;
            border?: boolean;
            usdAmount: BigNumber;
            isEvmDomain?: boolean;

          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 PlaygroundOperations has 101 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export function PlaygroundOperations(): JSX.Element {
            const { wallet } = useWalletContext();
            const client = useWhaleApiClient();
            const dispatch = useAppDispatch();
            const { api, rpc } = usePlaygroundContext();

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

            export function WalletCreateRestoreSuccess({ route }: Props): JSX.Element {
              const { isWalletRestored, data } = route.params;
              const { network } = useNetworkContext();
              const { isLight } = useThemeContext();
              const { setWallet } = useWalletPersistenceContext();

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

            export function VaultCardStatus({
              vault,
              vaultStatus,
              colRatio,
              minColRatio,

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

              (props: WalletTextInputProps, ref: React.Ref<any>): JSX.Element => {
                const [isFocus, setIsFocus] = useState(false);
                const {
                  title,
                  titleTestID,
            Severity: Minor
            Found in mobile-app/app/components/WalletTextInputV2.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 PrivacyLock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export function PrivacyLock(): JSX.Element {
              const privacyLock = usePrivacyLockContext();
              const appState = useAppStateContext();
              const logger = useLogger();
            
            
            Severity: Minor
            Found in mobile-app/app/screens/PrivacyLock.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 useVaultStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export function useVaultStatus(
              status: LoanVaultState | undefined,
              collateralRatio: BigNumber,
              minColRatio: BigNumber,
              totalLoanAmount: BigNumber,

            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