Showing 137 of 388 total issues
Function getUSD_PER_DFI
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getUSD_PER_DFI (): Promise<BigNumber | undefined> {
return await this.cache.get<BigNumber>('USD_PER_DFI', async () => {
const usdt = await this.getPoolPair('DFI', 'USDT')
const usdc = await this.getPoolPair('DFI', 'USDC')
// const dusd = await this.getPoolPair('DFI', 'DUSD')
Function maxPriceAsBigNumber
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static maxPriceAsBigNumber (getter: () => BigNumber, setter: (data: BigNumber) => void): BufferComposer {
return {
fromBuffer: (buffer: SmartBuffer): void => {
const integer = readBigNumberUInt64(buffer)
const fraction = readBigNumberUInt64(buffer)
- 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 addTokensAndConnectionsToGraph
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private async addTokensAndConnectionsToGraph (poolPairList: PoolPairInfoWithId[]): Promise<void> {
for (const poolPair of poolPairList) {
if (await this.isPoolPairIgnored(poolPair)) {
continue
}
- 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 computePathsBetweenTokens
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private async computePathsBetweenTokens (
fromTokenId: string,
toTokenId: string
): Promise<SwapPathPoolPair[][]> {
const poolPairPaths: SwapPathPoolPair[][] = []
- 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 9 (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 compactSizeOptionalHex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static compactSizeOptionalHex (getter: () => string | undefined, setter: (data: string | undefined) => void): BufferComposer {
return {
fromBuffer: (buffer: SmartBuffer): void => {
const length = readCompactSize(buffer)
if (length > 0) {
- 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 catchUp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private async catchUp (): Promise<void> {
const lastBlock = await this.getCrawledTip()
const nextBlockHeight = lastBlock === undefined ? 0 : lastBlock.data.height + 1
const nextBlock = await this.getBlock(nextBlockHeight)
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async validate (hex: string): Promise<void> {
if (!hex.startsWith('040000000001')) {
return
}
- 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 getGovernanceProposalVotes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getGovernanceProposalVotes (
query: PaginationQuery = {
size: 30
},
id: string,
- 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 mapPriceAggregated
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private async mapPriceAggregated (block: RawBlock, token: string, currency: string): Promise<OraclePriceAggregated | undefined> {
const oracles = await this.tokenCurrencyMapper.query(`${token}-${currency}`, Number.MAX_SAFE_INTEGER)
const aggregated = {
total: new BigNumber(0),
- 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 getPoolPair
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private async getPoolPair (a: string, b: string): Promise<PoolPairInfo | undefined> {
try {
const result = await this.rpcClient.poolpair.getPoolPair(`${a}-${b}`, true)
if (Object.values(result).length > 0) {
return Object.values(result)[0]
- 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 getBestPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getBestPath (fromTokenId: string, toTokenId: string): Promise<BestSwapPathResult> {
const {
fromToken,
toToken,
paths
- 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
Consider simplifying this complex logical expression. Open
if (masternode !== undefined) {
await this.masternodeMapper.put({
...masternode,
ownerAddress: updates.owner ?? masternode.ownerAddress,
operatorAddress: updates.operator ?? masternode.operatorAddress,
Function put
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function put (hex: string, height: number, type: ScriptActivityType, txid: string, n: number): Promise<void> {
Function placeAuctionBid
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function placeAuctionBid (testing: Testing, vaultId: string, index: number, addr: string, tokenAmt: string): Promise<void> {
Function findAmountSymbol
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private findAmountSymbol (history: AccountHistory, outgoing: boolean): LegacySubgraphSwapFromTo | undefined {
for (const amount of history.amounts ?? []) {
const [value, symbol] = amount.split('@')
const isNegative = value.startsWith('-')
- 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 indexBlockStart
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async indexBlockStart (block: RawBlock): Promise<void> {
const poolPairs = await this.getPoolPairs(block)
for (const interval of AggregatedIntervals) {
for (const poolPair of poolPairs) {
- 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 getDexFeesPct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public async getDexFeesPct (poolPair: PoolPairInfo, fromToken: string, toToken: string): Promise<EstimatedDexFeesInPct | undefined> {
const { dexFeeInPctTokenA, dexFeeOutPctTokenA, dexFeeInPctTokenB, dexFeeOutPctTokenB } = poolPair
const tokenADirection = poolPair.idTokenA === fromToken ? 'in' : 'out'
const tokenBDirection = poolPair.idTokenB === toToken ? 'out' : 'in'
- 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 listSwaps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Get('listswaps')
async listSwaps (
@Query('network', NetworkValidationPipe) network: SupportedNetwork = 'mainnet'
): Promise<LegacyListSwapsResponse> {
const api = this.whaleApiClientProvider.getClient(network)
- 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 listSwaps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Get('listswaps')
async listSwaps (
@Query('network', NetworkValidationPipe) network: SupportedNetwork = 'mainnet'
): Promise<LegacyListSwapsResponse> {
const api = this.whaleApiClientProvider.getClient(network)
- 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"