oceanprotocol/market

View on GitHub

Showing 62 of 90 total issues

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

        <InputElement
          className={styles.keyInput}
          name={`${field.name}.key`}
          placeholder={keyPlaceholder}
          value={`${currentKey}`}
src/components/@shared/FormInput/InputElement/KeyValueInput/index.tsx on lines 122..128

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

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 getAlgoHelpText has 11 arguments (exceeds 6 allowed). Consider refactoring.
Open

  dtSymbolSelectedComputeAsset: string,
  dtBalanceSelectedComputeAsset: string,
  isConsumable: boolean,
  isAlgorithmConsumable: boolean,
  hasPreviousOrderSelectedComputeAsset: boolean,
Severity: Major
Found in src/components/Asset/AssetActions/ButtonBuy/index.tsx - About 1 hr to fix

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

                  <button
                    type="button"
                    data-role="copy-address"
                    title="Copy Address"
                    className={styles.btnCopy}
    Severity: Major
    Found in src/components/@shared/DirectMessages/Header.tsx and 1 other location - About 1 hr to fix
    src/components/@shared/DirectMessages/Header.tsx on lines 84..95

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

    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

                <button
                  type="button"
                  aria-label="button"
                  data-role="back-button"
                  className={styles.btnBack}
    Severity: Major
    Found in src/components/@shared/DirectMessages/Header.tsx and 1 other location - About 1 hr to fix
    src/components/@shared/DirectMessages/Header.tsx on lines 100..111

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

    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 {
        type,
        name,
        description,
        tags,
    Severity: Major
    Found in src/components/Publish/_utils.ts and 1 other location - About 1 hr to fix
    src/@context/Asset.tsx on lines 206..220

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

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

    export default function Header() {
      const { address: accountId } = useAccount()
      const {
        conversations,
        conversationId,
    Severity: Minor
    Found in src/components/@shared/DirectMessages/Header.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 getAccessDetailsFromTokenPrice has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
    Open

    function getAccessDetailsFromTokenPrice(
      tokenPrice: TokenPrice,
      timeout?: number
    ): AccessDetails {
      const accessDetails = {} as AccessDetails
    Severity: Minor
    Found in src/@utils/accessDetailsAndPricing.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

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

                  <Alert
                    title={content.asset.title}
                    badge={`Reason: ${purgatoryData?.reason}`}
                    text={content.asset.description}
                    state="error"
    Severity: Minor
    Found in src/components/Asset/AssetContent/index.tsx and 1 other location - About 50 mins to fix
    src/components/App/index.tsx on lines 31..36

    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

          {meta.touched && meta.error && (
            <div className={styles.error}>
              <ErrorMessage name={field.name} />
            </div>
          )}
    src/components/@shared/FormInput/InputElement/URLInput/index.tsx on lines 80..84

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

    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 getFileInfo has 8 arguments (exceeds 6 allowed). Consider refactoring.
    Open

      file: string,
      providerUrl: string,
      storageType: string,
      query?: string,
      headers?: KeyValuePair[],
    Severity: Major
    Found in src/@utils/provider.ts - About 45 mins to fix

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

            {meta.touched && meta.error && (
              <div className={styles.error}>
                <ErrorMessage name={field.name} />
              </div>
            )}
      src/components/@shared/FormInput/InputElement/MethodInput/index.tsx on lines 62..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 60.

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

      export default function CustomProvider(props: InputProps): ReactElement {
        const { chain } = useNetwork()
        const newCancelToken = useCancelToken()
        const { initialValues, setFieldError } = useFormikContext<FormPublishData>()
        const [field, meta, helpers] = useField(props.name)
      Severity: Minor
      Found in src/components/@shared/FormInput/InputElement/Provider/index.tsx - About 45 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

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

            const filteredConversations = conversations.filter(
              (conversation: IConversationWithAdditionalData) => {
                return (
                  conversation.recipients.length === 2 &&
                  conversation.recipients.includes(userDid)
      Severity: Minor
      Found in src/@context/DirectMessages/index.tsx and 1 other location - About 40 mins to fix
      src/@context/DirectMessages/index.tsx on lines 344..351

      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

          const filteredConversations = _conversations.filter(
            (conversation: IConversationWithAdditionalData) => {
              return (
                conversation.recipients.length === 2 &&
                conversation.recipients.includes(userDid)
      Severity: Minor
      Found in src/@context/DirectMessages/index.tsx and 1 other location - About 40 mins to fix
      src/@context/DirectMessages/index.tsx on lines 329..336

      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 order has 7 arguments (exceeds 6 allowed). Consider refactoring.
      Open

        signer: Signer,
        asset: AssetExtended,
        orderPriceAndFees: OrderPriceAndFees,
        accountId: string,
        hasDatatoken: boolean,
      Severity: Major
      Found in src/@utils/order.ts - About 35 mins to fix

        Function DecryptedMessage has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
        Open

        export default function DecryptedMessage({
          content,
          position = 'right'
        }: {
          content: IOrbisMessageContent & { decryptedMessage?: string }
        Severity: Minor
        Found in src/components/@shared/DirectMessages/DecryptedMessage.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 getFileInfo has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
        Open

        export async function getFileInfo(
          file: string,
          providerUrl: string,
          storageType: string,
          query?: string,
        Severity: Minor
        Found in src/@utils/provider.ts - 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 await datatoken.startOrder(
                  asset.accessDetails.datatoken.address,
                  orderParams.consumer,
                  orderParams.serviceIndex,
                  orderParams._providerFee,
        Severity: Major
        Found in src/@utils/order.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return await datatoken.buyFromDispenserAndOrder(
                    asset.services[0].datatokenAddress,
                    orderParams,
                    config.dispenserAddress
                  )
          Severity: Major
          Found in src/@utils/order.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return filteredConversations[0]
            Severity: Major
            Found in src/@context/DirectMessages/index.tsx - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language