XYOracleNetwork/sdk-xyo-react-js

View on GitHub

Showing 124 of 486 total issues

Function usePollingFunction has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

export const usePollingFunction = <T extends Payload = Payload>(
  config?: IndexedResultsConfig,
  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,
  functionToPoll?: FunctionToPoll,
  onResult?: (result: T[] | null) => void,

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

export const createPollingFunction = <T extends Payload = Payload>(
  config?: IndexedResultsConfig,
  pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,
  pollingFunction?: PollingFunction,
  onResult?: (result: T[] | null) => void,

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

const ButtonSection: React.FC<ButtonSectionProps> = ({
  href, to, buttonText,
}) => {
  const isMobile = useIsSmall()
  return href
Severity: Minor
Found in packages/sdk/packages/shared/src/components/BasicHero/BasicHero.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

Function useBoundWitnessClickHandler has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

export const useBoundWitnessClickHandler = () => {
  const mounted = useMounted()
  const {
    hashSelectionHistory, fetchFromHash, addSelection, clearHistory,
  } = usePayloadHashSelectionHistory(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 LayerAnimator has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export const LayerAnimator: React.FC<WithChildren<LayerAnimatorProps>> = ({
  animateLayers, children, layers, layersInitialized, map,
}) => {
  const layerIndexQueue = useRef<number[]>([])

Severity: Minor
Found in packages/sdk/packages/map/src/Components/LayerAnimator.tsx - About 3 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 useTryDiviners has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export const useTryDiviners = <T extends Payload = Payload>(config?: IndexedResultsConfig): (() => Promise<Payload[] | undefined | null>) => {
  const [node] = useProvidedNode()
  const { indexedQueries, processIndexedResults } = config ?? {}
  const parseIndexedResults = processIndexedResults?.parseIndexedResults

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

export const PayloadDynamicTableRow: React.FC<PayloadDynamicTableRowProps> = ({
  archive,
  columns,
  exploreDomain,
  network: networkProp,

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 payloadDynamicTableColumnConfigDefaults has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const payloadDynamicTableColumnConfigDefaults = (): PayloadDynamicTableColumnConfig => {
  const xs: PayloadDynamicTableColumnHeadData[] = [
    {
      alignment: 'left', name: 'Hash', slug: 'hash', width: '100%',
    },

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

    export const usePollingFunction = <T extends Payload = Payload>(
      config?: IndexedResultsConfig,
      pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,
      functionToPoll?: FunctionToPoll,
      onResult?: (result: T[] | null) => void,

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

        static async initializeAnimatedHeatMapSource(
          layers: MapLayer[],
          featureSet: Feature<Polygon>[][],
          map: Map,
          startColor?: string,
      Severity: Major
      Found in packages/sdk/packages/map/src/MapBoxClasses/MapHeat.ts - About 2 hrs to fix

        Function TestSentinel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        export const TestSentinel: React.FC<TestSentinelProps> = ({ children }) => {
          const [node] = useNode()
          const [addressField, setAddressField] = useState(address)
          const [tokenInterfaceField, setTokenInterfaceField] = useState(supportedTokenInterfaces[0])
          const [valid, setValid] = useState<boolean>()

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

        export const SimpleCard: React.FC<SimpleCardProps> = ({
          desc,
          iconImage,
          interactionVariant = 'card',
          headline,
        Severity: Minor
        Found in packages/sdk/packages/card/src/components/SimpleCard/SimpleCard.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 initializeAnimatedHeatMapSource has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          static async initializeAnimatedHeatMapSource(
            layers: MapLayer[],
            featureSet: Feature<Polygon>[][],
            map: Map,
            startColor?: string,
        Severity: Minor
        Found in packages/sdk/packages/map/src/MapBoxClasses/MapHeat.ts - 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 PayloadTableRow has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        export const PayloadTableRow: React.FC<PayloadTableRowProps> = ({
          archive,
          columns,
          exploreDomain,
          maxSchemaDepth,

        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 createPollingFunction has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const createPollingFunction = <T extends Payload = Payload>(
          config?: IndexedResultsConfig,
          pollDivinerConfig: PollingConfig = DEFAULT_POLLING_CONFIG,
          pollingFunction?: PollingFunction,
          onResult?: (result: T[] | null) => void,

          Function BasicHero has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const BasicHero: React.FC<BasicHeroProps> = ({
            backgroundImage,
            title,
            gradientTitle,
            backgroundColor,
          Severity: Minor
          Found in packages/sdk/packages/shared/src/components/BasicHero/BasicHero.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 orderedHistory has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

          export const orderedHistory = async (addressHistory?: BoundWitness[], order: 'asc' | 'desc' = 'asc') => {
            if (addressHistory?.length) {
              const stack: BoundWitness[] = []
              const youngestBW = await findYoungestBW(addressHistory)
              const hashes = await PayloadHasher.hashes(addressHistory)

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

          export const EmbedCardHeader: React.FC<CardHeaderProps> = () => {
            const { refreshHuri, huri } = useResolvePayload()
            const {
              activePlugin, timestampLabel, hideElementsConfig,
            } = useEmbedPluginState()

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

          export const HashSelectionHistoryProvider: React.FC<HashSelectionHistoryProviderProps> = ({
            archivist,
            children,
            defaultHashSelectionHistory,
            defaultNestedBoundWitnesses,

          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/sdk/packages/wallet/src/contexts/Wallet/usePromise.ts - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language