DeFiCh/jellyfish

View on GitHub

Showing 358 of 388 total issues

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

  @Get()
  async list (
    @Query() query: PaginationQuery
  ): Promise<ApiPagedResponse<PriceTicker>> {
    const items = await this.priceTickerMapper.query(query.size, query.next)
Severity: Major
Found in apps/whale-api/src/module.api/price.controller.ts and 1 other location - About 2 hrs to fix
apps/whale-api/src/module.api/oracle.controller.ts on lines 15..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 107.

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

  @Get()
  async list (
    @Query() query: PaginationQuery
  ): Promise<ApiPagedResponse<Oracle>> {
    const items = await this.oracleMapper.query(query.size, query.next)
Severity: Major
Found in apps/whale-api/src/module.api/oracle.controller.ts and 1 other location - About 2 hrs to fix
apps/whale-api/src/module.api/price.controller.ts on lines 24..32

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

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

  public async checkSwapType (swap: PoolSwapData): Promise<SwapType | undefined> {
    const dftx = await this.findCompositeSwapDfTx(swap.txid)
    // if dftx is undefined, no composite swap is returned so check for swap
    if (dftx === undefined || dftx.pools.length <= 1) {
      const poolPairInfo = await this.deFiDCache.getPoolPairInfo(swap.poolPairId)
Severity: Minor
Found in apps/whale-api/src/module.api/poolpair.service.ts - About 2 hrs 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 invalidate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  async invalidate (block: RawBlock): Promise<void> {
    const hidList = new Set<string>()

    for (const txn of block.tx) {
      const isEvmTx = checkIfEvmTx(txn)
Severity: Minor
Found in apps/whale-api/src/module.indexer/model/script.aggregation.ts - About 2 hrs 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

  await testing.rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), {
    prices: [
      { tokenAmount: '2@DFI', currency: 'USD' },
      { tokenAmount: '2@LOAN', currency: 'USD' }
    ]
Severity: Major
Found in apps/whale-api/src/module.api/address.controller.spec.ts and 1 other location - About 2 hrs to fix
apps/whale-api/src/module.api/address.controller.spec.ts on lines 65..70

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

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

  await testing.rpc.oracle.setOracleData(oracleId, Math.floor(new Date().getTime() / 1000), {
    prices: [
      { tokenAmount: '2@DFI', currency: 'USD' },
      { tokenAmount: '2@LOAN', currency: 'USD' }
    ]
Severity: Major
Found in apps/whale-api/src/module.api/address.controller.spec.ts and 1 other location - About 2 hrs to fix
apps/whale-api/src/module.api/address.controller.spec.ts on lines 25..30

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

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 (options.a.symbol !== 'DFI') {
      await this.testing.token.mint({ amount: options.a.amount, symbol: options.a.symbol })
    } else {
      await this.testing.token.dfi({ amount: options.a.amount })
    }
Severity: Major
Found in packages/jellyfish-testing/src/fixture.ts and 1 other location - About 2 hrs to fix
packages/jellyfish-testing/src/fixture.ts on lines 28..32

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

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

  async activePrice (fixedIntervalPriceId: string, activePrice: string, timeout: number = 30000): Promise<void> {
    return await waitForCondition(async () => {
      const data: any = await this.sncc.rpc.call('getfixedintervalprice', [fixedIntervalPriceId])
      // eslint-disable-next-line
      if (data.activePrice.toString() !== activePrice) {
Severity: Major
Found in packages/testcontainers/src/containers/NativeChainWaitFor.ts and 1 other location - About 2 hrs to fix
packages/testcontainers/src/containers/NativeChainWaitFor.ts on lines 227..237

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

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 (options.b.symbol !== 'DFI') {
      await this.testing.token.mint({ amount: options.b.amount, symbol: options.b.symbol })
    } else {
      await this.testing.token.dfi({ amount: options.b.amount })
    }
Severity: Major
Found in packages/jellyfish-testing/src/fixture.ts and 1 other location - About 2 hrs to fix
packages/jellyfish-testing/src/fixture.ts on lines 23..27

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

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

  async nextPrice (fixedIntervalPriceId: string, nextPrice: string, timeout: number = 30000): Promise<void> {
    return await waitForCondition(async () => {
      const data: any = await this.sncc.rpc.call('getfixedintervalprice', [fixedIntervalPriceId])
      // eslint-disable-next-line
      if (data.nextPrice.toString() !== nextPrice) {
Severity: Major
Found in packages/testcontainers/src/containers/NativeChainWaitFor.ts and 1 other location - About 2 hrs to fix
packages/testcontainers/src/containers/NativeChainWaitFor.ts on lines 207..217

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

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

  async listVaults (pagination: VaultPagination = {}, options: ListVaultOptions = {}): Promise<Array<Vault | VaultActive | VaultLiquidation>> {
    return await this.client.call(
      'listvaults',
      [options, pagination],
      {
Severity: Major
Found in packages/jellyfish-api-core/src/category/loan.ts and 1 other location - About 2 hrs to fix
packages/jellyfish-api-core/src/category/vault.ts on lines 81..92

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

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

  async listVaults (pagination: VaultPagination = {}, options: ListVaultOptions = {}): Promise<Array<Vault | VaultActive | VaultLiquidation>> {
    return await this.client.call(
      'listvaults',
      [options, pagination],
      {
Severity: Major
Found in packages/jellyfish-api-core/src/category/vault.ts and 1 other location - About 2 hrs to fix
packages/jellyfish-api-core/src/category/loan.ts on lines 356..367

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

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

export class CUpdateMasternodeAddress extends ComposableBuffer<UpdateMasternodeAddress> {
  composers (umn: UpdateMasternodeAddress): BufferComposer[] {
    return [
      ComposableBuffer.uInt8(() => umn.addressType, v => umn.addressType = v),
      ComposableBuffer.compactSizeOptionalHex(() => umn.addressPubKeyHash, v => umn.addressPubKeyHash = v)
packages/jellyfish-transaction/src/script/dftx/dftx_balance.ts on lines 25..32
packages/jellyfish-transaction/src/script/dftx/dftx_balance.ts on lines 66..73
packages/jellyfish-transaction/src/script/dftx/dftx_price.ts on lines 13..20
packages/jellyfish-transaction/src/script/dftx/dftx_price.ts on lines 31..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 104.

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

  async index (block: RawBlock): Promise<void> {
    for (const txn of block.tx) {
      const isEvmTx = checkIfEvmTx(txn)

      for (const vin of txn.vin) {
Severity: Minor
Found in apps/whale-api/src/module.indexer/model/script.activity.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 invalidate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  async invalidate (block: RawBlock): Promise<void> {
    for (const txn of block.tx) {
      const isEvmTx = checkIfEvmTx(txn)

      for (const vin of txn.vin) {
Severity: Minor
Found in apps/whale-api/src/module.indexer/model/script.unspent.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 listAccountHistory has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  @Get('/history')
  async listAccountHistory (
    @Param('address') address: string,
      @Query() query: PaginationQuery): Promise<ApiPagedResponse<AddressHistory>> {
    if (address === 'mine') {
Severity: Minor
Found in apps/whale-api/src/module.api/address.controller.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

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

const OracleTokenCurrencyMapping: ModelMapping<OracleTokenCurrency> = {
  type: 'oracle_token_currency',
  index: {
    key_oracle_id: {
      name: 'oracle_token_currency_key_oracle_id',
Severity: Major
Found in apps/whale-api/src/module.model/oracle.token.currency.ts and 12 other locations - About 1 hr to fix
apps/whale-api/src/module.model/oracle.history.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.active.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.aggregated.interval.ts on lines 12..27
apps/whale-api/src/module.model/oracle.price.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.feed.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.ts on lines 5..20
apps/whale-api/src/module.model/script.activity.ts on lines 5..20
apps/whale-api/src/module.model/script.unspent.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vin.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vout.ts on lines 6..21
apps/whale-api/src/module.model/vault.auction.batch.history.ts on lines 5..20

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

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

const OraclePriceFeedMapping: ModelMapping<OraclePriceFeed> = {
  type: 'oracle_price_feed',
  index: {
    key_sort: {
      name: 'oracle_price_feed_key_sort',
Severity: Major
Found in apps/whale-api/src/module.model/oracle.price.feed.ts and 12 other locations - About 1 hr to fix
apps/whale-api/src/module.model/oracle.history.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.active.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.aggregated.interval.ts on lines 12..27
apps/whale-api/src/module.model/oracle.price.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/oracle.token.currency.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.ts on lines 5..20
apps/whale-api/src/module.model/script.activity.ts on lines 5..20
apps/whale-api/src/module.model/script.unspent.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vin.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vout.ts on lines 6..21
apps/whale-api/src/module.model/vault.auction.batch.history.ts on lines 5..20

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

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

const ScriptUnspentMapping: ModelMapping<ScriptUnspent> = {
  type: 'script_unspent',
  index: {
    hid_sort: {
      name: 'script_unspent_hid_sort',
Severity: Major
Found in apps/whale-api/src/module.model/script.unspent.ts and 12 other locations - About 1 hr to fix
apps/whale-api/src/module.model/oracle.history.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.active.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.aggregated.interval.ts on lines 12..27
apps/whale-api/src/module.model/oracle.price.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.feed.ts on lines 5..20
apps/whale-api/src/module.model/oracle.token.currency.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.ts on lines 5..20
apps/whale-api/src/module.model/script.activity.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vin.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vout.ts on lines 6..21
apps/whale-api/src/module.model/vault.auction.batch.history.ts on lines 5..20

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

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

const OraclePriceActiveMapping: ModelMapping<OraclePriceActive> = {
  type: 'oracle_price_active',
  index: {
    key_sort: {
      name: 'oracle_price_active_key_sort',
Severity: Major
Found in apps/whale-api/src/module.model/oracle.price.active.ts and 12 other locations - About 1 hr to fix
apps/whale-api/src/module.model/oracle.history.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.aggregated.interval.ts on lines 12..27
apps/whale-api/src/module.model/oracle.price.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/oracle.price.feed.ts on lines 5..20
apps/whale-api/src/module.model/oracle.token.currency.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.aggregated.ts on lines 5..20
apps/whale-api/src/module.model/pool.swap.ts on lines 5..20
apps/whale-api/src/module.model/script.activity.ts on lines 5..20
apps/whale-api/src/module.model/script.unspent.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vin.ts on lines 5..20
apps/whale-api/src/module.model/transaction.vout.ts on lines 6..21
apps/whale-api/src/module.model/vault.auction.batch.history.ts on lines 5..20

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

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language