xylabs/sdk-react

View on GitHub

Showing 39 of 148 total issues

Function MyEtherWalletEthersLoader has 93 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 = window as any
  const ethereum = global.ethereum
Severity: Major
Found in packages/crypto/src/contexts/Ethers/MyEtherWallet.tsx - About 3 hrs to fix

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

    export class GoogleStandardEvents<T extends Record<string, unknown>> {
      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 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 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const Template: StoryFn<WalletDiscoveryPaperProps> = (args) => {
            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 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 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
              const hash = md5(value)
              const block = Math.floor(size / count)
            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 usePromise has 56 lines of code (exceeds 25 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: Major
            Found in packages/promise/src/usePromise.ts - About 2 hrs to fix

              Function OperaEthersLoader has 54 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 = window as any
                const ethereum = global.ethereum
              Severity: Major
              Found in packages/crypto/src/contexts/Ethers/Opera.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 useBusyTiming has 51 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 PixelDebugger has 49 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: Minor
                  Found in packages/pixel-debugger/src/components/PixelDebugger.tsx - About 1 hr to fix

                    Function ExperimentsDebugger has 47 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 46 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 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()
                          const localStorageKey = buildLocalStorageKey(localStorageProp)
                          const childList = makeChildrenArray(children)
                        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 39 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
                          const hash = md5(value)
                          const block = Math.floor(size / count)
                        Severity: Minor
                        Found in packages/identicon/src/components/Identicon.tsx - About 1 hr to fix

                          Function InvertibleThemeProvider has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const InvertibleThemeProvider: React.FC<InvertibleThemeProviderProps> = ({
                            options,
                            children,
                            dark,
                            resolve = false,
                          Severity: Minor
                          Found in packages/invertible-theme/src/InvertibleThemeProvider.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 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

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

                              calculateExperiment: (name: string, localStorageProp: string | boolean, variants: VariantData[], userEvents: UserEventHandler<UserEventsProps>) => {
                                const localStorageKey = ExperimentsHelper.buildLocalStorageKey(localStorageProp)
                                const totalWeight = ExperimentsHelper.calcTotalWeight(variants)
                            
                                ExperimentsHelper.loadOutcomes()
                            Severity: Minor
                            Found in packages/experiments/src/lib/ExperimentsHelper.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 CookieConsentBody has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const CookieConsentBody: React.FC<CookieConsentProps> = ({ acceptOnScroll, acceptOnTimer = 0, onAccept, ...props }) => {
                              const { accepted, setAccepted, storageName } = useCookieConsent()
                            
                              const onScroll = () => {
                                //hide it one the user has scrolled at least one page
                            Severity: Minor
                            Found in packages/cookie-consent/src/components/CookieConsentBody.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

                            Severity
                            Category
                            Status
                            Source
                            Language