Showing 137 of 388 total issues
Function after
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async after (): Promise<void> {
await this.generate(1)
// separate the dfip2203 setgov as
// set dfip2203 in the list above will throw
Function run
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Interval(6000)
async run (): Promise<void> {
if (this.vaultId === undefined) {
this.vaultId = await this.client.loan.createVault({
loanSchemeId: 'MIN150',
Function shouldQueryPartitionSortPagination
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function shouldQueryPartitionSortPagination (database: Database): Promise<void> {
const window43 = await database.query(PartitionSortMapping.index.composite_a, {
partitionKey: '1000',
limit: 2,
order: SortOrder.DESC
Function listAccountHistory
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Get('/history')
async listAccountHistory (
@Param('address') address: string,
@Query() query: PaginationQuery): Promise<ApiPagedResponse<AddressHistory>> {
if (address === 'mine') {
Function mapPriceAggregated
has 40 lines of code (exceeds 25 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),
Function put
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async put<M extends Model> (mapping: ModelMapping<M>, model: M): Promise<void> {
const indexes = Object.values(mapping.index)
const persisted = await this.get(mapping, model.id) as M
if (persisted !== 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 getStats
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getStats (jsonPath?: string): Promise<LegacyStats | any> {
const stats: StatsData = await this.api.stats.get()
// Fire async requests at the same time and await results
const [
Function shouldQueryWithAscDesc
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function shouldQueryWithAscDesc (database: Database): Promise<void> {
const partitionADesc = await database.query(PartitionMapping.index.partition_a, {
limit: 100,
order: SortOrder.DESC
})
Function getBestPath
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getBestPath (fromTokenId: string, toTokenId: string): Promise<BestSwapPathResult> {
const {
fromToken,
toToken,
paths
Function fromScript
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fromScript (script: Script, network: NetworkName): DecodedAddress | undefined {
const p2wpkh = fromScriptP2WPKH(script, network)
if (p2wpkh !== undefined) {
return {
type: AddressType.P2WPKH,
Function getCmd
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected getCmd (opts: StartOptions): string[] {
const cmds = [...super.getCmd(opts),
'-regtest=1',
'-jellyfish_regtest=1',
'-txnotokens=0',
Function getDfTxTransactions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private getDfTxTransactions (block: RawBlock): Array<DfTxTransaction<any>> {
const transactions: Array<DfTxTransaction<any>> = []
for (let i = 0; i < block.tx.length; i++) {
const txn = block.tx[i]
- 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 12 (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 parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async parse (txn: defid.Transaction): Promise<string[]> {
const result: string[] = []
for (const vin of txn.vin) {
result.push(...(await this.utxo.extractFromVin(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 createDeFiTx
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createDeFiTx (
opDeFiTx: OP_DEFI_TX,
changeScript: Script,
outValue: BigNumber = new BigNumber('0'),
utxos: Prevout[] = []
Function computePathsBetweenTokens
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async computePathsBetweenTokens (
fromTokenId: string,
toTokenId: string
): Promise<SwapPathPoolPair[][]> {
const poolPairPaths: SwapPathPoolPair[][] = []
Function Home
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function Home (): JSX.Element {
const siteConfig = useDocusaurusContext().siteConfig
return (
<Layout description={siteConfig.tagline}>
Function indexTransaction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async indexTransaction (block: RawBlock, transaction: DfTxTransaction<UpdateOracle>): Promise<void> {
const txn = transaction.txn
const data = transaction.dftx.data
await this.oracleMapper.put({
id: data.oracleId,
Function getGovernanceProposalVotes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getGovernanceProposalVotes (
query: PaginationQuery = {
size: 30
},
id: string,
Function list
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
list (): CreateLoanScheme[] {
return [
{
id: 'MIN150',
interestRate: new BigNumber('5'),