kodadot/nft-gallery

View on GitHub

Showing 177 of 177 total issues

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

export default function useTransak() {
  const config = useRuntimeConfig()
  const { urlPrefix } = usePrefix()

  const getChainConfig = (prefix: Prefix) => {
Severity: Minor
Found in composables/useTransak.ts - About 1 hr to fix

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

    export default function () {
      const colorMode = useColorMode()
      const { $i18n } = useNuxtApp()
    
      const isDarkMode = computed<boolean>(() => colorMode.value === 'dark')
    Severity: Minor
    Found in composables/useTheme.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 useMigrateDeposit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export function useMigrateDeposit(
      prefix: ComputedRef<Prefix>,
      itemCount: number,
      account = '',
    ) {
    Severity: Minor
    Found in composables/useMigrate.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 useTransactionStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    function useTransactionStatus() {
      const status = ref<TransactionStatus>(TransactionStatus.Unknown)
      const isLoading = ref(false)
    
      const resolveStatus = (
    Severity: Minor
    Found in composables/useTransactionStatus.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 constructNfts has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const constructNfts = async () => {
        const events = (
          data.value as {
            events: { meta: string, nft: NFTWithMetadata, timestamp: string }[]
          }
    Severity: Minor
    Found in components/carousel/utils/useCarouselEvents.ts - About 1 hr to fix

      Function useCollectionForMint has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const useCollectionForMint = () => {
        const collections = ref<MintedCollection[]>()
        const { accountId } = useAuth()
        const { urlPrefix } = usePrefix()
      
      
      Severity: Minor
      Found in composables/massmint/useMassMint.ts - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        export const availablePrefixWithIcon = () => {
          return availablePrefixes().map((chain) => {
            return {
              ...chain,
              icon: chainIcons[chain.value] || '',
        Severity: Major
        Found in utils/chain.ts and 1 other location - About 1 hr to fix
        utils/chain.ts on lines 67..74

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 59.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function useMakingOfferStore has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useMakingOfferStore = defineStore('makingOffer', () => {
          const {
            items,
            chain,
            count,
        Severity: Minor
        Found in stores/makeOffer.ts - About 1 hr to fix

          Function massGenerate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            const massGenerate = async () => {
              try {
                clearMassMint()
                if (isSub.value) {
                  await populateTokenIds()
          Severity: Minor
          Found in composables/drop/massmint/useDropMassMint.ts - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export const allPrefixWithIcon = () => {
              return allPrefixes().map((chain) => {
                return {
                  ...chain,
                  icon: chainIcons[chain.value] || '',
            Severity: Major
            Found in utils/chain.ts and 1 other location - About 1 hr to fix
            utils/chain.ts on lines 59..66

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 59.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export async function execAcceptOfferTx(item: ActionAcceptOffer, api, executeTransaction) {
              if (item.urlPrefix === 'ahk' || item.urlPrefix === 'ahp') {
                await execAcceptOffer(item, api, executeTransaction)
              }
            }
            Severity: Major
            Found in composables/transaction/transactionOfferAccept.ts and 1 other location - About 1 hr to fix
            composables/transaction/transactionOffer.ts on lines 60..64

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            export async function execMakingOfferTx(item: ActionOffer, api, executeTransaction) {
              if (item.urlPrefix === 'ahk' || item.urlPrefix === 'ahp') {
                await execMakingOffer(item, api, executeTransaction)
              }
            }
            Severity: Major
            Found in composables/transaction/transactionOffer.ts and 1 other location - About 1 hr to fix
            composables/transaction/transactionOfferAccept.ts on lines 25..29

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

            export const formatNFT = (nfts, chain?: string): CarouselNFT[] => {
              if (!nfts) {
                return []
              }
              const { urlPrefix } = usePrefix()
            Severity: Minor
            Found in utils/carousel.ts - About 1 hr to fix

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

              async function payRoyaltyAssetHub(
                legacy,
                api,
                price,
                royalty,
              Severity: Minor
              Found in composables/transaction/transactionBuy.ts - About 1 hr to fix

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

                  const getOdaToken = async () => {
                    const getMetadata = await fetchOdaToken(urlPrefix.value, collectionId, tokenId)
                    const metadata = getMetadata.metadata
                
                    if (!metadata) {
                Severity: Minor
                Found in components/gallery/useGalleryItem.ts - About 1 hr to fix

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

                  async function execBuyStatemine(item: ActionBuy, api, executeTransaction) {
                    const nfts = Array.isArray(item.nfts) ? item.nfts : [item.nfts]
                    const transactions = await Promise.all(
                      nfts.map(async ({ id: nftId, price, royalty }) => {
                        const legacy = isLegacy(nftId)
                  Severity: Minor
                  Found in composables/transaction/transactionBuy.ts - About 1 hr to fix

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

                    export const listForSell = (mintedNFts: TokenToList[]) => {
                      const isLoading = ref(true)
                      const {
                        blockNumber,
                        transaction,
                    Severity: Minor
                    Found in composables/massmint/massMintHelpers.ts - About 1 hr to fix

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

                      export const resolveMedia = (mimeType?: string): MediaType => {
                        if (!mimeType) {
                          return MediaType.UNKNOWN
                        }
                      
                      
                      Severity: Minor
                      Found in components/rmrk/utils.ts - About 1 hr to fix

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

                        export function formatNumber(amount?: string | number): string {
                          if (!amount) {
                            return '0'
                          }
                          const number
                        Severity: Minor
                        Found in utils/format/balance.ts - About 1 hr to fix

                          Similar blocks of code found in 3 locations. Consider refactoring.
                          Open

                            executeTransaction({
                              cb: api.tx.utility.batchAll,
                              arg: [transactions.flat()],
                              successMessage: item.successMessage,
                              errorMessage: item.errorMessage,
                          Severity: Major
                          Found in composables/transaction/transactionCreateSwap.ts and 2 other locations - About 1 hr to fix
                          composables/transaction/transactionBuy.ts on lines 92..97
                          composables/transaction/transactionOffer.ts on lines 52..57

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 57.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language