xylabs/sdk-react

View on GitHub

Showing 39 of 148 total issues

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

export const useNavigateToEthAddress = () => {
  const navigate = useNavigate()
  const navigateToEthAddress = (
    address: EthAddress,
    event: React.MouseEvent,
Severity: Minor
Found in packages/crypto/src/hooks/useNavigateToEthAddress.ts - 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 Experiments has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Experiments: React.FC<ExperimentsProps> = (props) => {
  const { name, children, localStorageProp = true } = props
  const userEvents = useUserEvents()
  const localStorageKey = buildLocalStorageKey(localStorageProp)
  const childList = makeChildrenArray(children)
Severity: Minor
Found in packages/experiments/src/components/Experiments.tsx - About 1 hr to fix

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

    export const usePromise = <TResult>(
      promise: () => Promise<TResult | undefined>,
      dependencies: DependencyList,
      debug: string | undefined = undefined,
    ): [TResult | undefined, Error | undefined, State | undefined] => {
    Severity: Minor
    Found in packages/promise/src/usePromise.ts - 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 NumberStatus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const NumberStatus: React.FC<NumberStatusProps> = ({
      error,
      format = '0[.]0a',
      color = 'primary',
      title,
    Severity: Minor
    Found in packages/number-status/src/NumberStatus.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 useRenderSpinCheck has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useRenderSpinCheck = (bounce: RenderSpinCheckBounce, config?: RenderSpinCheckConfig) => {
      const startTime = useMemo(() => Date.now(), [])
      const [error, setError] = useState<Error>()
    
      useEffect(() => {
    Severity: Minor
    Found in packages/render-spin-check/src/hooks/useRenderSpinCheck.tsx - About 1 hr to fix

      Function useEthWallet has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useEthWallet = (connector: EthWalletConnectorBase): EthWallet => {
        const [currentAccount, additionalAccounts] = useCurrentAccount(connector)
      
        const chainId = useChainId(connector)
      
      
      Severity: Minor
      Found in packages/crypto/src/wallets/third-party/hooks/useEthWallet.tsx - About 1 hr to fix

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

        const ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {
          const theme = useTheme()
          const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)
        
          const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {
        Severity: Minor
        Found in packages/button/src/components/ButtonExBase.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 useBusyTiming has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        export const useBusyTiming = (busy?: boolean, busyMinimum = 0) => {
          const [internalBusy, setInternalBusy] = useState(false)
          const [busyStart, setBusyStart] = useState(0)
        
          const timer = useMemo(
        Severity: Minor
        Found in packages/flexbox/src/hooks/useBusyTiming.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 BasePage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const BasePage: React.FC<BasePageProps> = ({
          disableGutters,
          children,
          beta,
          container,
        Severity: Minor
        Found in packages/base-page/src/components/BasePage/BasePage.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 calcSpacing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export const calcSpacing = (theme: Theme, values: BoxProps['margin'][]) => {
          for (const value of values) {
            if (value !== undefined) {
              if (typeof value === 'string') {
                return value
        Severity: Minor
        Found in packages/shared/src/calcSpacing.ts - About 35 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 TokenAmount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export const TokenAmount: React.FC<TokenAmountProps> = ({
          textFontFamily = '"Source Code Pro",monospace',
          textColor,
          statusColor,
          style,
        Severity: Minor
        Found in packages/crypto/src/components/TokenAmount/TokenAmount.tsx - About 35 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 getSelectedVariant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          getSelectedVariant: (name: string) => {
            const outcomes = ExperimentsHelper.loadOutcomes()
            const experiment = ExperimentsHelper.getExperiment(name)
            let total = 0
            if (experiment && outcomes) {
        Severity: Minor
        Found in packages/experiments/src/lib/ExperimentsHelper.ts - About 35 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

        Avoid too many return statements within this function.
        Open

            return 'xl'
        Severity: Major
        Found in packages/shared/src/hooks/useBreakpoint.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return defaultValue
          Severity: Major
          Found in packages/shared/src/hooks/useLocalStorage.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return <OperaEthersLoader>{children}</OperaEthersLoader>
            Severity: Major
            Found in packages/crypto/src/contexts/Ethers/Loader.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return <InfuraEthersLoader>{children}</InfuraEthersLoader>
              Severity: Major
              Found in packages/crypto/src/contexts/Ethers/Loader.tsx - About 30 mins to fix

                Function CoverProgress has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                export const CoverProgress: React.FC<CoverProgressProps> = (props) => {
                  const { paper = true, open, opacity = 0.25, errors, onRetry } = props
                  const theme = useTheme()
                  if (open) {
                    return (
                Severity: Minor
                Found in packages/common/src/components/CoverProgress.tsx - About 25 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 BusyBox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  (
                    {
                      background,
                      children,
                      component,
                Severity: Minor
                Found in packages/flexbox/src/components/BusyBox/BusyBox.tsx - About 25 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 AppBarExInner has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                const AppBarExInner: React.FC<AppBarExProps> = ({ children, menu, contextToolbar, systemToolbar, responsive, ...props }) => {
                  const { breakpoints } = useTheme()
                  const belowSm = useMediaQuery(breakpoints.down('sm'))
                  return (
                    <>
                Severity: Minor
                Found in packages/appbar/src/AppBarEx.tsx - About 25 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

                Severity
                Category
                Status
                Source
                Language