Showing 137 of 388 total issues
File mapping.ts
has 834 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { SmartBuffer } from 'smart-buffer'
import { readCompactSize, writeCompactSize } from '@defichain/jellyfish-buffer'
import { toBuffer, toOPCodes } from './_buffer'
import { OPCode, StaticCode } from './opcode'
import { OP_PUSHDATA } from './data'
OP_CODES
has 60 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export const OP_CODES = {
/**
* Read SmartBuffer and create OPCode[] stack.
*
* Using P2WPKH redeem script as an example.
File Composer.ts
has 416 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import BigNumber from 'bignumber.js'
import { SmartBuffer } from 'smart-buffer'
import { readCompactSize, writeCompactSize } from './CompactSize'
import { readVarInt, writeVarInt } from './VarInt'
import { getBitsFrom } from './BitMask'
File poolpair.service.ts
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Inject, Injectable, NotFoundException } from '@nestjs/common'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import BigNumber from 'bignumber.js'
import { PoolPairInfo } from '@defichain/jellyfish-api-core/dist/category/poolpair'
import { SemaphoreCache } from '@defichain-apps/libs/caches'
Function list
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
list (): TokenSetup[] {
return [
{
create: {
symbol: 'BTC',
File TransactionSkipped.ts
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Network } from './Network'
const MainNetSkippedTxIds = new Set([
'ffcafd71820269ffe9cbecc12619154a3c5b272f1437d4e0242ff73d2bf09e4e',
'4218d310d9a67b5e9a93d2a9ecf17bd70bda7a3670191efbc755b05c5fb8a6a4',
ComposableBuffer
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export abstract class ComposableBuffer<T> implements BufferComposer {
protected readonly data: T
abstract composers (data: T): BufferComposer[]
Function getSwapsHistory
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
async getSwapsHistory (
network: NetworkName,
limit: number,
nextToken: NextToken
): Promise<{ swaps: LegacySubgraphSwap[], next: NextToken }> {
- 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
File PoolPairController.ts
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Controller, DefaultValuePipe, Get, Inject, Logger, ParseIntPipe, Query } from '@nestjs/common'
import { PoolPairData } from '@defichain/whale-api-client/dist/api/poolpairs'
import { WhaleApiClientProvider } from '../providers/WhaleApiClientProvider'
import { NetworkValidationPipe, SupportedNetwork } from '../pipes/NetworkValidationPipe'
import BigNumber from 'bignumber.js'
Loan
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Loan {
private readonly client: ApiClient
constructor (client: ApiClient) {
this.client = client
File account.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import BigNumber from 'bignumber.js'
import { ApiClient } from '../.'
/**
* Single account ID (CScript or address) or reserved words,
File stats.controller.ts
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Controller, Get, Inject, NotFoundException } from '@nestjs/common'
import { BurnData, RewardDistributionData, StatsData, SupplyData } from '@defichain/whale-api-client/dist/api/stats'
import { SemaphoreCache } from '@defichain-apps/libs/caches'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { BlockMapper } from '../module.model/block'
File token.controller.spec.ts
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Test, TestingModule } from '@nestjs/testing'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { parseDATSymbol, TokenController } from './token.controller'
import { createPoolPair, createToken } from '@defichain/testing'
File specifications.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Database, SortOrder } from '../database'
import { PartitionMapping, PartitionSortMapping } from './_model'
import { PARTITION_SORTS, PARTITIONS } from './_fixtures'
/**
File blockchain.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import BigNumber from 'bignumber.js'
import { ApiClient } from '../.'
/**
* Blockchain RPCs for DeFi Blockchain
Function list
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
list (): SetCollateralToken[] {
return [
{
token: 'DFI',
fixedIntervalPriceId: 'DFI/USD',
Function index
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
async index (block: RawBlock): Promise<void> {
const records: Record<string, ScriptAggregation> = {}
function findScriptAggregation (hex: string, type: string): ScriptAggregation {
const hid = HexEncoder.asSHA256(hex)
- 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
File dftx.ts
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { SmartBuffer } from 'smart-buffer'
import { BufferComposer, ComposableBuffer } from '@defichain/jellyfish-buffer'
import {
AccountToAccount,
AccountToUtxos,
File update.masternode.spec.ts
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
createTestingApp,
DelayedEunosPayaTestContainer,
invalidateFromHeight,
stopTestingApp,
Function getSwapsHistory
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getSwapsHistory (
network: NetworkName,
limit: number,
nextToken: NextToken
): Promise<{ swaps: LegacySubgraphSwap[], next: NextToken }> {