Showing 71 of 201 total issues
Function computeDelete
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async computeDelete(
did: string,
consumer: Signer,
jobId: string,
providerUri: string,
Function computeStop
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async computeStop(
did: string,
consumerAddress: string,
jobId: string,
providerUri: string,
Function createNFT
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async createNFT<G extends boolean = false>(
nftData: NftCreateData,
estimateGas?: G
): Promise<G extends false ? string : BigNumber> {
if (!nftData.templateIndex) nftData.templateIndex = 1
Function sendTx
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function sendTx(
estGas: BigNumber,
signer: Signer,
gasFeeMultiplier: number,
functionToSend: ContractFunction,
Function computeStatus
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async computeStatus(
providerUri: string,
consumerAddress: string,
jobId?: string,
agreementId?: string,
Function createFixedRate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async createFixedRate<G extends boolean = false>(
dtAddress: string,
address: string,
fixedRateParams: FreCreationParams,
estimateGas?: G
Function createDatatoken
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public async createDatatoken<G extends boolean = false>(
nftAddress: string,
address: string,
minter: string,
paymentCollector: 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
Consider simplifying this complex logical expression. Open
if (feeHistory.maxPriorityFeePerGas) {
let aggressiveFeePriorityFeePerGas = feeHistory.maxPriorityFeePerGas.toString()
let aggressiveFeePerGas = feeHistory.maxFeePerGas.toString()
if (gasFeeMultiplier > 1) {
aggressiveFeePriorityFeePerGas = Math.round(
Function initializeCompute
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async initializeCompute(
assets: ComputeAsset[],
algorithm: ComputeAlgorithm,
computeEnv: string,
validUntil: number,
Function getErcCreationParams
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async getErcCreationParams(dtParams: DatatokenCreateParams): Promise<any> {
let name: string, symbol: string
// Generate name & symbol if not present
if (!dtParams.name || !dtParams.symbol) {
;({ name, symbol } = generateDtName())
Function initialize
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async initialize(
did: string,
serviceId: string,
fileIndex: number,
consumerAddress: string,
Function createAsset
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
name: string,
symbol: string,
owner: Signer,
assetUrl: any, // files object
templateIDorAddress: string | number, // If string, it's template address , otherwise, it's templateId
Function waitForAqua
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public async waitForAqua(
did: string,
txid?: string,
signal?: AbortSignal
): Promise<Asset> {
- 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 getErcCreationParams
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private async getErcCreationParams(dtParams: DatatokenCreateParams): Promise<any> {
let name: string, symbol: string
// Generate name & symbol if not present
if (!dtParams.name || !dtParams.symbol) {
;({ name, symbol } = generateDtName())
- 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 checkDidFiles
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async checkDidFiles(
did: string,
serviceId: string,
providerUri: string,
withChecksum: boolean = false,
Function deployAccessListContract
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async deployAccessListContract<G extends boolean = false>(
nameAccessList: string,
symbolAccessList: string,
tokenURI: string[],
transferable: boolean = false,
Function orderAsset
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
asset: Asset,
consumerAccount: Signer,
config: Config,
datatoken: Datatoken,
providerUrl?: string,
Function getConfig
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getConfig(network: string | number, infuraProjectId?: string): Config {
const filterBy = typeof network === 'string' ? 'network' : 'chainId'
let config = configHelperNetworks.find((c) => c[filterBy] === network)
Function getComputeEnvironments
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getComputeEnvironments(
providerUri: string,
signal?: AbortSignal
): Promise<{ [chainId: number]: ComputeEnvironment[] }> {
const providerEndpoints = await this.getEndpoints(providerUri)
Function getExchange
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getExchange(exchangeId: string): Promise<FixedPriceExchange> {
const result: FixedPriceExchange = await this.contract.getExchange(exchangeId)
const exchange: FixedPriceExchange = {
active: result.active,
datatoken: result.datatoken,