xylabs/sdk-react

View on GitHub

Showing 48 of 179 total issues

Function MyEtherWalletEthersLoader has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const MyEtherWalletEthersLoader: React.FC<PropsWithChildren<Props>> = (props) => {
  const { children } = props
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  const global = globalThis as any
  const ethereum = global.ethereum
Severity: Major
Found in packages/crypto/src/contexts/Ethers/MyEtherWallet.tsx - About 4 hrs to fix

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

    const ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>(({
      funnel, intent, target, placement, disableUserEvents, href, ...props
    }, ref) => {
      const theme = useTheme()
      const userEvents = useUserEvents()
    Severity: Minor
    Found in packages/button/src/components/ButtonExBase.tsx - About 4 hrs 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

    GoogleStandardEvents has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class GoogleStandardEvents<T extends EmptyObject> {
      addPaymentInfo() {
        return new GoogleStandardEvent<GoogleBaseProperties | GoogleAddPaymentInfoProperties | T>('add_paymennt_info')
      }
    
    
    Severity: Minor
    Found in packages/pixel/src/lib/Tracking/Google/StandardEvents.ts - About 3 hrs to fix

      SnapchatStandardEvents has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class SnapchatStandardEvents<T extends SnapchatStandardProperties> {
        achievementUnlocked() {
          return new SnapchatStandardEvent<T>('ACHIEVEMENT_UNLOCKED')
        }
      
      
      Severity: Minor
      Found in packages/pixel/src/lib/Tracking/Snapchat/StandardEvents.ts - About 3 hrs to fix

        Function usePromise has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const usePromise = <TResult>(
          promise: () => Promise<TResult | undefined>,
          dependencies: DependencyList,
          config?: UsePromiseConfig<TResult>,
        ): [TResult | undefined, Error | undefined, UsePromiseState | undefined] => {
        Severity: Major
        Found in packages/promise/src/usePromise.ts - About 3 hrs to fix

          Function mergeBoxlikeStyles has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const mergeBoxlikeStyles = <T extends BoxlikeComponentProps>(theme: Theme, props: BoxlikeComponentProps, defaultProps?: BoxlikeComponentProps): T => {
            const {
              alignContent,
              alignItems,
              alignSelf,
          Severity: Major
          Found in packages/shared/src/mergeBoxlikeStyles.ts - About 2 hrs to fix

            Function Template has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const Template: StoryFn<WalletDiscoveryPaperProps> = (args: WalletDiscoveryPaperProps) => {
              const [selectedWallet, setSelectedWallet] = useState<EIP6963Connector | undefined>()
              const [errorArray, setErrorArray] = useState<[string, Error][]>([])
            
              useEffect(() => {
            Severity: Major
            Found in packages/crypto/src/wallets/components/Discovery/Paper.stories.tsx - About 2 hrs to fix

              Function PixelDebugger has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const PixelDebugger: React.FC = () => {
                const { isDebugging } = useContext(DebugUserEventsContext)
                // TODO - when adding in the location hook to detect location change, was dropping the setEvents in usePixelAltSendHand
                const theme = useTheme()
                const [displayEvents, setDisplayEvents] = useState(false)
              Severity: Major
              Found in packages/pixel-debugger/src/components/PixelDebugger.tsx - About 2 hrs to fix

                Function updateCanvas has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                const updateCanvas = (canvas: React.RefObject<HTMLCanvasElement>, props: IdenticonProps) => {
                  const {
                    value = '', size = 400, bg = 'transparent', count = 5, palette, iconPadding = 0,
                  } = props
                  let { fg } = props
                Severity: Minor
                Found in packages/identicon/src/components/Identicon.tsx - About 2 hrs 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 EthAccountBox has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                export const EthAccountBox: React.FC<EthAccountProps & FlexBoxProps> = ({
                  address,
                  icon = false,
                  iconSize = 16,
                  iconOnly = false,
                Severity: Minor
                Found in packages/crypto/src/components/EthAccount/EthAccountBox.tsx - About 2 hrs 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 53 lines of code (exceeds 25 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: Major
                Found in packages/flexbox/src/hooks/useBusyTiming.tsx - About 2 hrs to fix

                  Function DarkModeIconButton has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const DarkModeIconButton: React.FC<DarkModeIconButtonProps> = ({
                    darkMode,
                    defaultDarkModeColor,
                    defaultLightModeColor,
                    toggleMode,
                  Severity: Minor
                  Found in packages/invertible-theme/src/Buttons/DarkModeIconButton.tsx - About 2 hrs 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 OperaEthersLoader has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const OperaEthersLoader: React.FC<PropsWithChildren<Props>> = (props) => {
                    const { children } = props
                    // eslint-disable-next-line @typescript-eslint/no-explicit-any
                    const global = globalThis as any
                    const ethereum = global.ethereum
                  Severity: Minor
                  Found in packages/crypto/src/contexts/Ethers/Opera.tsx - About 1 hr to fix

                    Function ExperimentsDebugger has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const ExperimentsDebugger: React.FC = ({ ...props }) => {
                      const [experiments] = useLocalStorage<ExperimentsData>(ExperimentsLocalStorageKey, {})
                      const [outcomes, setOutcomes] = useLocalStorage<OutcomesData>(OutcomesLocalStorageKey, {})
                    
                      const sumUpVariants = (items: VariantData[]) => items.reduce((acc, curr) => acc + curr.weight, 0)
                    Severity: Minor
                    Found in packages/experiments/src/components/ExperimentsDebugger.tsx - About 1 hr to fix

                      Function TrustEthersLoader has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const TrustEthersLoader: React.FC<PropsWithChildren<Props>> = (props) => {
                        const { children } = props
                        const [error, setError] = useState<Error>()
                        const [signer, setSigner] = useState<JsonRpcSigner>()
                        const [localAddress, setLocalAddress] = useState<EthAddress>()
                      Severity: Minor
                      Found in packages/crypto/src/contexts/Ethers/Trust.tsx - About 1 hr to fix

                        Function LinkToEx has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const LinkToEx = forwardRef<HTMLAnchorElement, LinkExProps>(({
                          intent,
                          funnel,
                          onClick,
                          to,
                        Severity: Minor
                        Found in packages/link/src/LinkToEx.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 ThemeEnabledComponent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const ThemeEnabledComponent = () => {
                          const theme = useTheme()
                          const {
                            darkMode, lightMode, mode, setMode,
                          } = useColorSchemeEx()

                          Function LinkEx has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const LinkEx = forwardRef<HTMLAnchorElement, LinkExProps>(({
                            onClick,
                            disableUserEvents,
                            funnel,
                            intent,
                          Severity: Minor
                          Found in packages/link/src/LinkEx.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 Experiments has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const Experiments: React.FC<ExperimentsProps> = (props) => {
                            const {
                              name, children, localStorageProp = true,
                            } = props
                            const userEvents = useUserEvents()
                          Severity: Minor
                          Found in packages/experiments/src/components/Experiments.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 updateCanvas has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const updateCanvas = (canvas: React.RefObject<HTMLCanvasElement>, props: IdenticonProps) => {
                            const {
                              value = '', size = 400, bg = 'transparent', count = 5, palette, iconPadding = 0,
                            } = props
                            let { fg } = props
                          Severity: Minor
                          Found in packages/identicon/src/components/Identicon.tsx - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language