Showing 137 of 388 total issues
Function byteLength
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function byteLength (num: number): number {
validateUInt53(num)
return num < 0xfd ? 1 : num <= 0xffff ? 3 : num <= 0xffffffff ? 5 : 9
}
- 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 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
- 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 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()
}
- 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 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
- 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 synchronize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async synchronize (): Promise<boolean> {
const indexed = await this.blockMapper.getHighest()
if (indexed === undefined) {
return await this.indexGenesis()
}
- 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 closeAllOpenOffers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async closeAllOpenOffers (): Promise<void> {
const orders = await this.testing.rpc.icxorderbook.listOrders()
for (const orderTx of Object.keys(orders).splice(1)) {
const offers = await this.testing.rpc.icxorderbook.listOrders({ orderTx: orderTx })
for (const offerTx of Object.keys(offers).splice(1)) {
- 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 fromAddress
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function fromAddress (address: string, network: NetworkName): DecodedAddress | undefined {
try {
const decodedBech32 = fromBech32(address)
const p2wpkh = fromBech32P2WPKH(decodedBech32, 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 getUpdates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private getUpdates (transaction: DfTxTransaction<UpdateMasternode>): { owner?: string, operator?: string } {
const updates: { owner?: string, operator?: string } = {}
for (const update of transaction.dftx.data.updates) {
if (update.address !== undefined && update.updateType === 0x01) {
- 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 optionalHex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static optionalHex (length: number, getter: () => string | undefined, setter: (data: string | undefined) => void): BufferComposer {
return {
fromBuffer: (buffer: SmartBuffer): void => {
const buff = Buffer.from(buffer.readBuffer(length))
if (buff.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 getBlockSubsidy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getBlockSubsidy (eunosHeight: number, height: number): BigNumber {
let blockSubsidy = new BigNumber(405.04)
if (height >= eunosHeight) {
const reductionAmount = new BigNumber(0.01658) // 1.658%
- 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 generate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async generate (nblocks: number, address?: string | undefined, maxTries: number = 1000000): Promise<void> {
if (address == null && this.sncc instanceof StartedNativeChainContainer) {
address = this.sncc.masterNodeKey?.operator.address
}
if (address == null && this.sncc instanceof MasterNodeRegTestContainer) {
- 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 indexTransaction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async indexTransaction (block: RawBlock, transaction: DfTxTransaction<SetOracleData>): Promise<void> {
const feeds = mapPriceFeeds(block, [transaction])
const pairs = new Set<[string, string]>()
for (const feed of feeds) {
- 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 test
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Post('/test')
@HttpCode(200)
async test (@Body(ValidationPipe) tx: RawTxDto): Promise<void> {
const maxFeeRate = this.getMaxFeeRate(tx)
try {
- 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 get
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async get (id: string): Promise<LoanVaultActive | LoanVaultLiquidated> {
try {
const vault = await this.client.loan.getVault(id)
return await this.mapLoanVault(vault)
} catch (err) {
- 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 getGovernanceProposal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getGovernanceProposal (id: string): Promise<GovernanceProposal> {
try {
const proposal = await this.client.governance.getGovProposal(id)
return this.mapGovernanceProposal(proposal)
} catch (err) {
- 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 writeVarInt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function writeVarInt (value: number, buffer: SmartBuffer): void {
let n = new BN(value)
validateMaxSafeInteger(n)
const tmp = []
- 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 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') {
- 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"