XYOracleNetwork/clients

View on GitHub

Showing 134 of 134 total issues

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

export const getJob = (): Job => {
  const schedule: string = process.env.TZERO_STOCK_MARKET_WITNESS_JOB_SCHEDULE || '10 minutes'
  const task = getTask()
  return {
    name, schedule, task,
packages/automation-witness-server/src/Jobs/EthereumGas/getJob.ts on lines 7..13

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

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

const handler: RequestHandler<AddressPathParams, Payload[]> = async (req, res, next) => {
  const { address } = req.params
  const { node } = req.app
  if (address) {
    let modules: ModuleInstance[] = []

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

export const addWitnessModuleFactories = (container: Container) => {
  const locator = container.get<ModuleFactoryLocator>(TYPES.ModuleFactoryLocator)
  locator.register(
    CryptoNftCollectionWitness.factory({ providers: () => getProvidersFromEnv(8) }),
  )

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

    export const getCommand = async (node: NodeInstance): Promise<boolean> => {
      return await new Promise((resolve) => {
        terminal.once('key', (name: string) => {
          if (name === 'ESCAPE') resolve(true)
          if (name === 'CTRL_C') resolve(false)
    Severity: Minor
    Found in packages/cli/src/terminal/getCommand.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

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

    export const configureEnvironmentFromAWSSecret: ConfigurationFunction = async () => {
      // If an AWS ARN was supplied for Secrets Manager
      const awsEnvSecret = process.env.AWS_ENV_SECRET_ARN
      if (awsEnvSecret) {
        // Merge the values from AWS into the current ENV
    packages/node/packages/express/packages/server/src/configureEnvironment.ts on lines 3..12

    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

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

    export const configureEnvironment = async () => {
      // If an AWS ARN was supplied for Secrets Manager
      const awsEnvSecret = process.env.AWS_ENV_SECRET_ARN
      if (awsEnvSecret) {
        // Merge the values from AWS into the current ENV
    packages/node/packages/core/packages/app/src/configuration/environment/providers/awsSecret.ts on lines 5..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 2 locations. Consider refactoring.
    Open

    export const builder: CommandBuilder = (yargs: Argv) =>
      yargs.usage('Usage: $0 config <command> [Options]').commandDir(Path.parse(__filename).name, opts).demandCommand()
    Severity: Major
    Found in packages/cli/src/command/commands/config.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/account.ts on lines 13..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 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

    export const builder: CommandBuilder = (yargs: Argv) =>
      yargs.usage('Usage: $0 account <command> [Options]').commandDir(Path.parse(__filename).name, opts).demandCommand()
    Severity: Major
    Found in packages/cli/src/command/commands/account.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/config.ts on lines 13..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 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

    export const builder: CommandBuilder = (yargs: Argv) =>
      yargs.usage('Usage: $0 archivist insert <payloads..>').positional('payloads', {
        array: true, demandOption: true, type: 'string',
      })
    Severity: Major
    Found in packages/cli/src/command/commands/archivist/insert.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/archivist/get.ts on lines 16..19

    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 const builder: CommandBuilder = (yargs: Argv) =>
      yargs.usage('Usage: $0 archivist get <hashes..>').positional('hashes', {
        array: true, demandOption: false, type: 'string',
      })
    Severity: Major
    Found in packages/cli/src/command/commands/archivist/get.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/archivist/insert.ts on lines 14..17

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

    export const addArchivistModuleFactories = (container: Container) => {
      const locator = container.get<ModuleFactoryLocator>(TYPES.ModuleFactoryLocator)
      locator.register(MemoryArchivist)
    }
    packages/modules-mongo/src/Archivist/addArchivistModuleFactories.ts on lines 6..9
    packages/node/packages/express/packages/dependencies/src/Module/Sentinel/addSentinelModuleFactories.ts on lines 6..9

    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

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

    export const handler = (argv: ArgumentsCamelCase<Arguments>) => {
      printLine(JSON.stringify(command))
      printLine(JSON.stringify(argv))
    }
    Severity: Major
    Found in packages/cli/src/command/commands/archivist/insert.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/config.ts on lines 18..21

    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

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

    export const handler = function (argv: ArgumentsCamelCase<Arguments>) {
      printLine(JSON.stringify(command))
      printLine(JSON.stringify(argv))
    }
    Severity: Major
    Found in packages/cli/src/command/commands/account.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/diviner/divine.ts on lines 19..22

    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

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

    export const handler = function (argv: ArgumentsCamelCase<Arguments>) {
      printLine(JSON.stringify(command))
      printLine(JSON.stringify(argv))
    }
    Severity: Major
    Found in packages/cli/src/command/commands/diviner/divine.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/account.ts on lines 18..21

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

    export const addArchivistModuleFactories = (container: Container) => {
      const locator = container.get<ModuleFactoryLocator>(TYPES.ModuleFactoryLocator)
      locator.register(MongoDBArchivist)
    }
    packages/node/packages/express/packages/dependencies/src/Module/Archivist/addArchivistModuleFactories.ts on lines 6..9
    packages/node/packages/express/packages/dependencies/src/Module/Sentinel/addSentinelModuleFactories.ts on lines 6..9

    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

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

    export const handler = (argv: ArgumentsCamelCase<Arguments>) => {
      printLine(JSON.stringify(command))
      printLine(JSON.stringify(argv))
    }
    Severity: Major
    Found in packages/cli/src/command/commands/config.ts and 1 other location - About 1 hr to fix
    packages/cli/src/command/commands/archivist/insert.ts on lines 22..25

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

    export const addSentinelModuleFactories = (container: Container) => {
      const locator = container.get<ModuleFactoryLocator>(TYPES.ModuleFactoryLocator)
      locator.register(MemorySentinel)
    }
    packages/modules-mongo/src/Archivist/addArchivistModuleFactories.ts on lines 6..9
    packages/node/packages/express/packages/dependencies/src/Module/Archivist/addArchivistModuleFactories.ts on lines 6..9

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

    const handler: RequestHandler<AddressPathParams, ModuleQueryResult, PostAddressRequestBody> = async (req, res, next) => {
      const { address } = req.params
      const { node } = req.app
      // console.log(`address post[${node.address}]: ${address}`)
      // console.log('\nManifest')

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

      export const getEthereumGasWitness: WitnessProvider<Provider> = async (provider = getProvider()): Promise<AttachableWitnessInstance[]> => {
        const witnesses: AttachableWitnessInstance[] = [
          await EthereumGasBlocknativeWitness.create({
            account: await getAccount(WalletPaths.EthereumGas.Witness.Blocknative),
            config: { schema: EthereumGasBlocknativeWitnessConfigSchema },

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

        const generateThumbnail = async (
          address: string,
          name: string,
          score: Hash,
          archivist: ArchivistInstance,
          Severity
          Category
          Status
          Source
          Language