XYOracleNetwork/plugins

View on GitHub

Showing 36 of 223 total issues

Function getNftMetadata has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

export const getNftMetadata = async (
  /**
   * The address of the NFT contract to search for
   */
  contractAddress: string,

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

export const getNftCollectionNfts = async (
  /**
   * The address of the NFT contract to search for
   */
  contractAddress: string,

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

export const getErc1967SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1967SlotStatus> => {
  const status: Erc1967SlotStatus = {
    address,
    implementation: address,
    slots: {

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

export const calculateAllPropertiesDistribution = <T>(array: T[]): Distribution<T> => {
  const distribution: Distribution<T> = {}

  for (const item of array) {
    for (const property in item) {

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

export const getNftCollectionNfts = async (
  /**
   * The address of the NFT contract to search for
   */
  contractAddress: string,

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

    export const getAppraisalsFromValidAuthoritiesValidator = (dictionary: Record<Hash, WithMeta<Payload>>): PayloadValidationFunction<EscrowTerms> => {
      return (terms: EscrowTerms) => {
        const appraisals = assertEx(terms.appraisals, () => `${name}: No appraisals: ${terms.appraisals}`)
        const appraisalAuthorities = assertEx(terms.appraisalAuthorities, () => `${name}: No appraisalAuthorities: ${terms.appraisalAuthorities}`)
    
    

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

    export const getNftMetadata = async (
      /**
       * The address of the NFT contract to search for
       */
      contractAddress: string,

      Function getNftsOwnedByAddress has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const getNftsOwnedByAddress = async (
        /** @param publicAddress The address of the wallet to search for NFTs */
        publicAddress: string,
        /** @param provider The provider to use for accessing the block chain */
        providers: Provider[],

        Function getEstimatesByAsset has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        const getEstimatesByAsset = (terms: EscrowTerms, dictionary: Record<Hash, WithMeta<Payload>>): Record<Hash, WithSources<HashLeaseEstimate>[]> => {
          const assets = assertEx(terms.assets, () => `${name}: No assets: ${terms.assets}`)
          const estimates = Object.values(dictionary).filter(isHashLeaseEstimateWithSources) as unknown as WithSources<HashLeaseEstimate>[]
          const estimatesByAsset: Record<Hash, WithSources<HashLeaseEstimate>[]> = {}
          for (const estimate of estimates) {

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

        export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
          try {
            const url = new URL(urlToCheck)
            let protocol = url.protocol
            let host = url.host
        Severity: Minor
        Found in packages/payloadset/packages/api/src/lib/checkIpfsUrl.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 checkIpfsUrl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
          try {
            const url = new URL(urlToCheck)
            let protocol = url.protocol
            let host = url.host

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

        export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
          try {
            const url = new URL(urlToCheck)
            let protocol = url.protocol
            let host = url.host
        Severity: Minor
        Found in packages/payloadset/packages/http/src/lib/checkIpfsUrl.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 nftResult has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            nfts.map(async (nft) => {
              try {
                const {
                  contract, identifier, metadata_url,
                } = nft

          Function result has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  maxNftsArray.map(async (_value, i) => {
                    const tokenId = (await tryCall(async () => await enumerable.tokenByIndex(i, { blockTag: block }))) ?? BigInt(i)
                    if (tokenId !== undefined) {
                      const supply
                        = finalTypes.includes(toTokenType('ERC1155'))

            Function getErc1967SlotStatus has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const getErc1967SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1967SlotStatus> => {
              const status: Erc1967SlotStatus = {
                address,
                implementation: address,
                slots: {

              Function getNftCollectionMetadata has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const getNftCollectionMetadata = async (
                /**
                 * The address of the NFT contract to search for
                 */
                contractAddress: string,

                Function checkIpfsUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
                  try {
                    const url = new URL(urlToCheck)
                    let protocol = url.protocol
                    let host = url.host
                Severity: Minor
                Found in packages/payloadset/packages/http/src/lib/checkIpfsUrl.ts - About 1 hr to fix

                  Function checkIpfsUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
                    try {
                      const url = new URL(urlToCheck)
                      let protocol = url.protocol
                      let host = url.host

                    Function checkIpfsUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const checkIpfsUrl = (urlToCheck: string, ipfsGateway?: string): string => {
                      try {
                        const url = new URL(urlToCheck)
                        let protocol = url.protocol
                        let host = url.host
                    Severity: Minor
                    Found in packages/payloadset/packages/api/src/lib/checkIpfsUrl.ts - About 1 hr to fix

                      Function getNftsOwnedByAddress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export const getNftsOwnedByAddress = async (
                        /** @param publicAddress The address of the wallet to search for NFTs */
                        publicAddress: string,
                        /** @param provider The provider to use for accessing the block chain */
                        providers: Provider[],

                      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