XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 124 of 486 total issues

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

export const useAccount = ({
  wallet, account, index, required = false,
}: AccountHookParams = {}): [
  AccountInstance | null | undefined,
  Error | undefined,
Severity: Minor
Found in packages/sdk/packages/wallet/src/hooks/useAccount.ts - 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 parseModuleType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const parseModuleType = (mod?: ModuleInstance): CyNodeModuleTypes => {
  let type: CyNodeModuleTypes = 'module'
  if (mod) {
    if (isArchivistInstance(mod)) {
      type = 'archivist'
Severity: Minor
Found in packages/sdk/packages/node-renderer/src/Cytoscape/lib/parseModuleType.ts - 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 FooterLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export const FooterLink: React.FC<LinkExProps> = ({
  target, to, toOptions, href, margin = 0.5, variant = 'body2', ...props
}) => {
  if (href) {
    const url = new URL(assertEx(href, () => 'href not set'))
Severity: Minor
Found in packages/sdk/packages/footer/src/Link.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 PointMapInner has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PointMapInner: React.FC<PointMapInnerProps> = ({
  accessToken, payload, ...props
}) => {
  const theme = useTheme()
  const locationPayload = payload ? (payload as GeographicCoordinateSystemLocationPayload) : undefined

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

export const useWrapperAccount = (
  account?: AccountInstance | null,
): [AccountInstance | null | undefined, Error | undefined, PromiseState | undefined] => {
  return usePromise(async () => {
    return await globalWrapperWalletMutex.runExclusive(async () => {
Severity: Minor
Found in packages/sdk/packages/wallet/src/hooks/useWrapperAccount.ts - 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 PropertyBox has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  ({
    titleProps, title, value, children, size = 'medium', tip, actions, required, badge = false, ...props
  }, ref) => {
    const sizeValueHeight: Record<SizeProp, number> = {
      large: 48,
Severity: Minor
Found in packages/sdk/packages/property/src/components/Property.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 ModuleHoverPopper has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const ModuleHoverPopper: React.FC<ModuleHoverPopperProps> = ({
  anchorEl, onClose, onModuleDetails, onModuleExplore, node, ...props
}) => {
  const { address, name } = node?.data() ?? {}
  return (

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

export const useTriggerFreshIndexedResult = (indexedResultsConfig?: IndexedResultsConfig, trigger?: boolean) => {
  const { processIndexedResults, refresh } = indexedResultsConfig ?? {}

  const freshResult = useCallback(async () => {
    if (refresh && trigger) {

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

export const UniswapPairsTableView: React.FC<UniswapPairsRendererProps> = ({ payload, ...props }) => {
  const [order, setOrder] = useState<Order>('asc')
  const [orderBy, setOrderBy] = useState<string>('symbol')
  const [page, setPage] = useState(0)
  const [rowsPerPage, setRowsPerPage] = useState(20)

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

export const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({
  connected, walletRdns, tableCellProps,
}) => {
  const {
    disableWallet, enableWallet, wallets,

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

export const PoweredByXyoButton: React.FC<PoweredByXyoButtonProps> = ({
  busy = false,
  href,
  to,
  toOptions,

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

export const DetailsCardContent = forwardRef<HTMLDivElement, DetailsCardContentProps>(({
  collapsed, boundwitness, setCollapsed, ...props
}, ref) => {
  const { height } = useTableHeight()
  const [activeTab, setActiveTab] = useState(0)

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

export const NftScoreRenderer: React.FC<NftScoreRendererProps> = ({ payload, ...props }) => {
  const nftScorePayload = payload && isNftScorePayload(payload) ? (payload as NftScore) : undefined
  const categories = nftScorePayload ? Object.entries(nftScorePayload).filter(isScore) : undefined
  const sources = nftScorePayload?.sources?.length ? nftScorePayload.sources.join(', ') : undefined
  // this is temporary so that we can add the ability to get a timestamp via diviner later
Severity: Minor
Found in packages/plugins/packages/nft-score/src/components/NftScoreRenderer.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 PayloadValidationDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const PayloadValidationDetails: React.FC<PayloadValidationDetailsProps> = ({
  skipBody = false, value, ...props
}) => {
  const [validateErrors] = usePromise(async () => (value ? await new PayloadValidator(value).validate() : undefined), [value])

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

export const DeclarationReflectionViewer: React.FC<ReflectionViewerProps<DeclarationReflection>> = ({
  reflection, hiddenFlags, ...props
}) => {
  const safeSignatures = (signatures?: SignatureReflection[] | SignatureReflection) => {
    return (
Severity: Minor
Found in packages/sdk/packages/typedoc/src/ReflectionViewer/Declaration.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 XnsEstimateNameTextField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const XnsEstimateNameTextField: React.FC<XnsEstimateNameTextFieldProps & TextFieldProps> = ({
  maskOutput = true, onChange: onChangeProp, onBlur: onBlurProp, value, ...props
}) => {
  const theme = useTheme()
  const [validLength, setValidLength] = useState(false)

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

export const HashTableCell: React.FC<HashTableCellProps> = ({
  value, archive, dataType, network, exploreDomain, onHashClick, ...props
}) => {
  const ref = useRef<HTMLTableCellElement | null>(null)
  const [tableCellRef, dispatch] = useEvent<HTMLTableCellElement>(undefined, ref)
Severity: Minor
Found in packages/sdk/packages/shared/src/components/TableCell/HashTableCell.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

Avoid too many return statements within this function.
Open

    return null

    Avoid too many return statements within this function.
    Open

      if (typeof value[1] !== 'number') return false
    Severity: Major
    Found in packages/plugins/packages/nft-score/src/components/NftScoreRenderer.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return <ModuleSummary mod={mod} {...props} />
        Severity
        Category
        Status
        Source
        Language