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
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')
}
SnapchatStandardEvents
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
export class SnapchatStandardEvents<T extends SnapchatStandardProperties> {
achievementUnlocked() {
return new SnapchatStandardEvent<T>('ACHIEVEMENT_UNLOCKED')
}
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,
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(() => {
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,
- 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
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)
- 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
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] => {
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
Function DarkModeIconButton
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const DarkModeIconButton: React.FC<DarkModeIconButtonProps> = ({
darkMode,
defaultDarkModeColor,
defaultLightModeColor,
toggleMode,
- 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
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(
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)
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)
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>()
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)
- 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
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)
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,
- 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
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()
- 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
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
- 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"