DeFiCh/jellyfish

View on GitHub

Showing 137 of 388 total issues

Function waitForDeFiD has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  async waitForDeFiD (timeout = 45000): Promise<void> {
    const expiredAt = Date.now() + timeout

    while (expiredAt > Date.now()) {
      try {
Severity: Minor
Found in apps/playground-api/src/modules/PlaygroundModule.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

Function cycle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  @Interval(1000)
  async cycle (): Promise<void> {
    if (!this.running) {
      return
    }
Severity: Minor
Found in apps/whale-api/src/module.indexer/rpc.block.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

Function findPoolSwapFromTo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function findPoolSwapFromTo (history: AccountHistory | undefined, from: boolean, displaySymbol: string): PoolSwapFromToData | undefined {
  if (history?.amounts === undefined) {
    return undefined
  }

Severity: Minor
Found in apps/whale-api/src/module.api/poolpair.service.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 this.withAlive('model', details)
Severity: Major
Found in apps/whale-api/src/module.model/_model.probes.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return
    Severity: Major
    Found in apps/whale-api/src/module.api/rawtx.controller.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return await this.getTotalLiquidityUsdByBestPath(info)
      Severity: Major
      Found in apps/whale-api/src/module.api/poolpair.service.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return true
        Severity: Major
        Found in apps/whale-api/src/module.indexer/model/dftx/active.price.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return
          Severity: Major
          Found in apps/whale-api/src/module.api/rawtx.controller.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return undefined
            Severity: Major
            Found in packages/jellyfish-address/src/script/index.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return
              Severity: Major
              Found in apps/whale-api/src/module.api/rawtx.controller.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return info.reserveB.multipliedBy(2).multipliedBy(USDT_PER_DFI)
                Severity: Major
                Found in apps/whale-api/src/module.api/poolpair.service.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return undefined
                  Severity: Major
                  Found in packages/jellyfish-address/src/script/index.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return true
                    Severity: Major
                    Found in apps/whale-api/src/module.indexer/model/dftx/active.price.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return dfiPair.reserveB.div(dfiPair.reserveA).times(usdPerDFI)
                      Severity: Major
                      Found in apps/whale-api/src/module.api/poolpair.service.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return swap
                        Severity: Major
                        Found in apps/whale-api/src/module.api/legacy.subgraph.service.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return loanEmission.multipliedBy(split)
                                .times(60 * 60 * 24 / 30) // 30 seconds = 1 block
                                .times(365) // 1 year
                                .times(dfiPriceUSD)
                          Severity: Major
                          Found in apps/whale-api/src/module.api/poolpair.service.ts - About 30 mins to fix

                            Function listAuction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async listAuction (query: PaginationQuery): Promise<ApiPagedResponse<LoanVaultLiquidated>> {
                                const next = query.next !== undefined ? String(query.next) : undefined
                                const size = query.size > 30 ? 30 : query.size
                                let pagination: AuctionPagination
                            
                            
                            Severity: Minor
                            Found in apps/whale-api/src/module.api/loan.vault.service.ts - About 25 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 createPoolPair has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async createPoolPair (options: TestingPoolPairCreateRequest): Promise<poolpair.PoolPairInfo> {
                                if (options.a.symbol !== 'DFI') {
                                  await this.testing.token.create({ symbol: options.a.symbol })
                                }
                                if (options.b.symbol !== 'DFI') {
                            Severity: Minor
                            Found in packages/jellyfish-testing/src/fixture.ts - About 25 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 toObject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              toObject (): any {
                                function toObject (value: any): any {
                                  if (value instanceof ComposableBuffer) {
                                    return value.toObject()
                                  }
                            Severity: Minor
                            Found in packages/jellyfish-buffer/src/Composer.ts - About 25 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 readiness has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              async readiness (): Promise<HealthIndicatorResult> {
                                let highest: Block
                                let index: number | undefined
                                let defid: number | undefined
                            
                            
                            Severity: Minor
                            Found in apps/whale-api/src/module.model/_model.probes.ts - About 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language