XYOracleNetwork/sdk-xyo-client-js

View on GitHub

Showing 342 of 346 total issues

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

export const payloadHashesContainsAny = (bw: BoundWitness, payloadHashes: Hash[]): boolean => {
  return boundWitnessArrayPropertyContainsAny(bw, 'payload_hashes', payloadHashes)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAny.ts on lines 14..16

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

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

export const payloadSchemasContainsAny = (bw: BoundWitness, payloadSchemas: Schema[]): boolean => {
  return boundWitnessArrayPropertyContainsAny(bw, 'payload_schemas', payloadSchemas)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAny.ts on lines 14..16

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

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

export const payloadHashesContainsAll = (bw: BoundWitness, payloadHashes: Hash[]): boolean => {
  return boundWitnessArrayPropertyContainsAll(bw, 'payload_hashes', payloadHashes)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAny.ts on lines 14..16

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

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

export const addressesContainsAll = (bw: BoundWitness, addresses: Address[]): boolean => {
  return boundWitnessArrayPropertyContainsAll(bw, 'addresses', addresses)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAny.ts on lines 14..16

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

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

const createQuicknodeWss = (chainId: number) => {
  const quickNodeWSSUri = process.env.QUICKNODE_WSS_URI
  return quickNodeWSSUri ? new WebSocketProvider(quickNodeWSSUri, chainId) : undefined
}
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31

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

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

const createQuicknodeRpc = (chainId: number) => {
  const quickNodeHttpsUri = process.env.QUICKNODE_HTTPS_URI
  return quickNodeHttpsUri ? new JsonRpcProvider(quickNodeHttpsUri, chainId) : undefined
}
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26

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

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

      if (!isMetaEvent(eventName)) {
        forget(this.emitMetaEvent('listenerRemoved', { eventName, listener: listener as EventListener }))
      }
packages/modules/packages/module/packages/events/src/Events/Events.ts on lines 264..266

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

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

      if (!isMetaEvent(eventName)) {
        forget(this.emitMetaEvent('listenerAdded', { eventName, listener: listener as EventListener }))
      }
packages/modules/packages/module/packages/events/src/Events/Events.ts on lines 232..234

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

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

export const payloadSchemasContainsAll = (bw: BoundWitness, payloadSchemas: Schema[]): boolean => {
  return boundWitnessArrayPropertyContainsAll(bw, 'payload_schemas', payloadSchemas)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAny.ts on lines 14..16

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

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

const createQuicknodeRpc = (chainId: number) => {
  const quickNodeHttpsUri = process.env.QUICKNODE_HTTPS_URI
  return quickNodeHttpsUri ? new JsonRpcProvider(quickNodeHttpsUri, chainId) : undefined
}
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31

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

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

    assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)
Severity: Minor
Found in packages/manifest/packages/wrapper/src/WrapperEx.ts and 1 other location - About 35 mins to fix
packages/manifest/packages/wrapper/src/Wrapper.ts on lines 40..40

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

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

const createQuicknodeWss = (chainId: number) => {
  const quickNodeWSSUri = process.env.QUICKNODE_WSS_URI
  return quickNodeWSSUri ? new WebSocketProvider(quickNodeWSSUri, chainId) : undefined
}
packages/modules/packages/witness/packages/blockchain/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 23..26
packages/modules/packages/witness/packages/evm/packages/abstract/src/lib/getProviderFromEnv.ts on lines 28..31

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

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

    assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)
Severity: Minor
Found in packages/manifest/packages/wrapper/src/Wrapper.ts and 1 other location - About 35 mins to fix
packages/manifest/packages/wrapper/src/WrapperEx.ts on lines 64..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 46.

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

export const addressesContainsAny = (bw: BoundWitness, addresses: Address[]): boolean => {
  return boundWitnessArrayPropertyContainsAny(bw, 'addresses', addresses)
}
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadHashes/payloadHashesContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAll.ts on lines 12..14
packages/protocol/packages/boundwitness/packages/validator/src/lib/payloadSchemas/payloadSchemasContainsAny.ts on lines 14..16
packages/protocol/packages/boundwitness/packages/validator/src/lib/addresses/addressesContainsAll.ts on lines 12..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 46.

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

Avoid too many return statements within this function.
Open

        return (
          mod
            ? Array.isArray(mod)
              ? mod
              : [mod]

    Avoid too many return statements within this function.
    Open

            return Number.POSITIVE_INFINITY

      Avoid too many return statements within this function.
      Open

              return Object.values(this.modules) as T[]

        Avoid too many return statements within this function.
        Open

              return Object.values(value).every(item => isSerializable(item, maxDepth - 1))
        Severity: Major
        Found in packages/modules/packages/module/packages/model/src/lib/serializable.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return []

            Avoid too many return statements within this function.
            Open

              return false
            Severity: Major
            Found in packages/modules/packages/module/packages/model/src/lib/serializable.ts - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language