Showing 137 of 388 total issues
Function setup
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function setup (): Promise<void> {
accountAlice = await alice.generateAddress()
accountBob = await bob.generateAddress()
await alice.token.create({
Function mapPoolPair
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async mapPoolPair (
id: string,
info: PoolPairInfo,
totalLiquidityUsd?: BigNumber,
apr?: PoolPairData['apr'],
Function setupLoanToken
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function setupLoanToken (): Promise<void> {
const oracleId = await testing.rpc.oracle.appointOracle(await testing.generateAddress(), [
{ token: 'DFI', currency: 'USD' },
{ token: 'LOAN', currency: 'USD' }
], { weightage: 1 })
PoolPairService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class PoolPairService {
constructor (
@Inject('NETWORK') protected readonly network: NetworkName,
private readonly poolSwapPathfindingService: PoolSwapPathFindingService,
File place.auction.bid.spec.ts
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import { TestingGroup, Testing } from '@defichain/jellyfish-testing'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { createTestingApp, stopTestingApp, waitForIndexedHeight } from '../../../e2e.module'
import { VaultAuctionHistoryMapper } from '../../../module.model/vault.auction.batch.history'
StatsController
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Controller('/stats')
export class StatsController {
constructor (
protected readonly blockMapper: BlockMapper,
protected readonly priceTickerMapper: PriceTickerMapper,
Account
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class Account {
private readonly client: ApiClient
constructor (client: ApiClient) {
this.client = client
Blockchain
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class Blockchain {
private readonly client: ApiClient
constructor (client: ApiClient) {
this.client = client
Function update
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
async update (
updateMasternode: UpdateMasternode,
changeScript: Script,
collateral?: {
txid: string
File loan.ts
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ApiClient, token } from '..'
import {
AuctionPagination,
CloseVault,
CreateVault,
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)
- Read upRead up
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 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)
- Read upRead up
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 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) {
- Read upRead up
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') {
- Read upRead up
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) {
- Read upRead up
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 accountToUtxos
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
async accountToUtxos (accountToUtxos: AccountToUtxos, destinationScript: Script): Promise<TransactionSegWit> {
if (accountToUtxos.balances.length !== 1) {
throw new TxnBuilderError(TxnBuilderErrorType.INVALID_ACCOUNT_TO_UTXOS_INPUT,
'Conversion output `accountToUtxos.balances` array length must be one'
)
Function listYieldFarming
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Get('listyieldfarming')
async listYieldFarming (
@Query('network', NetworkValidationPipe) network: SupportedNetwork = 'mainnet'
): Promise<LegacyListYieldFarmingData> {
const api = this.whaleApiClientProvider.getClient(network)
Function fromAddress
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fromAddress (address: string, network: NetworkName): DecodedAddress | undefined {
try {
const decodedBech32 = fromBech32(address)
const p2wpkh = fromBech32P2WPKH(decodedBech32, network)
Function index
has a Cognitive Complexity of 14 (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) {
- Read upRead up
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 index
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async index (block: RawBlock): Promise<void> {
const records: Record<string, ScriptAggregation> = {}
function findScriptAggregation (hex: string, type: string): ScriptAggregation {
const hid = HexEncoder.asSHA256(hex)