kodadot/nft-gallery

View on GitHub

Showing 177 of 177 total issues

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

  return {
    isFetchingData,
    fetchPreviousPage,
    fetchNextPage,
    reachTopHandler,
Severity: Major
Found in composables/useListInfiniteScroll.ts and 1 other location - About 1 hr to fix
stores/makeOffer.ts on lines 25..38

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 64.

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

export function parseJson(jsonData: string): Record<string, Entry> {
  const { $consola } = useNuxtApp()

  try {
    const data = JSON.parse(jsonData)
Severity: Minor
Found in composables/massmint/parsers/parseJson.ts - About 1 hr to fix

    Function bindGoToEvents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    const bindGoToEvents = (event, app) => {
      const { accountId } = useAuth()
      const { urlPrefix } = usePrefix()
    
      let path = ''
    Severity: Minor
    Found in plugins/keyboardEvents.client.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 useDropMinimumFunds has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const useDropMinimumFunds = (amount = ref(1)) => {
      const { drop } = useDrop()
      const { urlPrefix } = usePrefix()
      const { itemDeposit } = useDeposit(urlPrefix)
    
    
    Severity: Minor
    Found in components/drops/useDrops.ts - About 1 hr to fix

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

      export const NAMES: Record<Prefix, string> = {
        ksm: 'Kusama',
        ahk: 'KusamaHub',
        dot: 'Polkadot',
        ahp: 'PolkadotHub',
      Severity: Major
      Found in libs/static/src/names.ts and 3 other locations - About 1 hr to fix
      libs/static/src/chains.ts on lines 68..79
      libs/static/src/chains.ts on lines 81..92
      libs/static/src/services.ts on lines 12..23

      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 63.

      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

        const { expiry, token } = await nftStorageApi<PinningKey>(
          `getKey/${address}`,
        ).catch((error: FetchError) => {
          throw new Error(
            `[NFT::STORAGE] Unable to GET KEY for reasons ${error.data}`,
      Severity: Major
      Found in services/nftStorage.ts and 1 other location - About 1 hr to fix
      services/replicate.ts on lines 91..97

      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 63.

      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 4 locations. Consider refactoring.
      Open

      export const EXPLORERS: Record<Prefix, string> = {
        ksm: 'https://kusama.subscan.io/account/',
        ahk: 'https://assethub-kusama.subscan.io/account/',
        dot: 'https://polkadot.subscan.io/account/',
        ahp: 'https://assethub-polkadot.subscan.io/account/',
      Severity: Major
      Found in libs/static/src/services.ts and 3 other locations - About 1 hr to fix
      libs/static/src/chains.ts on lines 68..79
      libs/static/src/chains.ts on lines 81..92
      libs/static/src/names.ts on lines 3..14

      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 63.

      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 4 locations. Consider refactoring.
      Open

      export const chainNames: Record<Prefix, string> = {
        ksm: 'Kusama',
        ahk: 'Kusama AssetHub',
        dot: 'Polkadot',
        ahp: 'Polkadot AssetHub',
      Severity: Major
      Found in libs/static/src/chains.ts and 3 other locations - About 1 hr to fix
      libs/static/src/chains.ts on lines 68..79
      libs/static/src/names.ts on lines 3..14
      libs/static/src/services.ts on lines 12..23

      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 63.

      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

        const prediction = await api<PredictionStatus>(
          `status/${predictionId}`,
        ).catch((error: FetchError) => {
          throw new Error(
            `[REPLICATE::STATUS] Unable to GET STATUS for reasons ${error.data}`,
      Severity: Major
      Found in services/replicate.ts and 1 other location - About 1 hr to fix
      services/nftStorage.ts on lines 46..52

      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 63.

      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 4 locations. Consider refactoring.
      Open

      export const chainInfo: Record<Prefix, string> = {
        ksm: 'kusama',
        ahk: 'statemine',
        dot: 'polkadot',
        ahp: 'statemint',
      Severity: Major
      Found in libs/static/src/chains.ts and 3 other locations - About 1 hr to fix
      libs/static/src/chains.ts on lines 81..92
      libs/static/src/names.ts on lines 3..14
      libs/static/src/services.ts on lines 12..23

      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 63.

      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

        try {
          const response = await api<ProfileResponse>('/profiles', {
            method: 'POST',
            body: profileData,
          })
      Severity: Major
      Found in services/profile.ts and 1 other location - About 1 hr to fix
      services/profile.ts on lines 159..174

      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 63.

      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

        try {
          const response = await api<ProfileResponse>(
            `/profiles/${updates.address}`,
            {
              method: 'PATCH',
      Severity: Major
      Found in services/profile.ts and 1 other location - About 1 hr to fix
      services/profile.ts on lines 143..155

      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 63.

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

      async function execMakingOffer(item: ActionOffer, api, executeTransaction) {
        const { accountId } = useAuth()
        const nfts = Array.isArray(item.token) ? item.token : [item.token]
        const transactions = await Promise.all(
          nfts.map(async ({ price, nftSn, collectionId, duration }) => {
      Severity: Minor
      Found in composables/transaction/transactionOffer.ts - About 1 hr to fix

        Function useReadyItems has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const useReadyItems = () => {
          const { urlPrefix } = usePrefix()
        
          const collections = ref<CollectionsReady['collectionEntities']>([])
          const entities = reactive({})
        Severity: Minor
        Found in composables/useMigrate.ts - About 1 hr to fix

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

          export function resolveMedia(mimeType?: string): MediaType {
            if (!mimeType) {
              return MediaType.UNKNOWN
            }
          
          
          Severity: Minor
          Found in utils/gallery/media.ts - About 1 hr to fix

            Function proccessData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const proccessData = (
              collectionsList: CollectionEntity[],
              collectionsSales: CollectionSales[],
            ) => {
              return Promise.all(
            Severity: Minor
            Found in components/landing/topCollections/utils/useTopCollections.ts - About 1 hr to fix

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

                    return {
                      ...item,
                      ...parsedItem,
                      description: replaceIndex(
                        correctText(item.description, parsedItem.description),
              Severity: Major
              Found in utils/mintUtils.ts and 1 other location - About 1 hr to fix
              utils/mintUtils.ts on lines 166..174

              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 62.

              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

                return massMints.map((item, index) => ({
                  ...item,
                  ...applyForAll,
                  description: replaceIndex(
                    correctText(item.description, applyForAll.description),
              Severity: Major
              Found in utils/mintUtils.ts and 1 other location - About 1 hr to fix
              utils/mintUtils.ts on lines 147..155

              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 62.

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

              export const useCarouselGenerativeNftEvents = () => {
                const nfts = ref<CarouselNFT[]>([])
                const eventType = ['newestList', 'latestSales']
                const dropsAhp = computedAsync(async () => {
                  return await getDrops({
              Severity: Minor
              Found in components/carousel/utils/useCarouselEvents.ts - About 1 hr to fix

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

                export const getListForSellItems = (
                  createdNFTs: CreatedNFT[],
                  tokens: TokenToMint[],
                  blockNumber: string,
                ) => {
                Severity: Minor
                Found in composables/massmint/massMintHelpers.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language