Showing 71 of 201 total issues
File Provider.ts
has 752 lines of code (exceeds 250 allowed). Consider refactoring. Open
import fetch from 'cross-fetch'
import { ethers, Signer, providers } from 'ethers'
import { LoggerInstance } from '../utils'
import {
Arweave,
File Datatoken.ts
has 584 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ethers, Signer } from 'ethers'
import Decimal from 'decimal.js'
import ERC20Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20Template.sol/ERC20Template.json'
import ERC20TemplateEnterprise from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC20TemplateEnterprise.sol/ERC20TemplateEnterprise.json'
import { amountToUnits, sendTx, ZERO_ADDRESS } from '../utils'
File NFT.ts
has 531 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { BigNumber, ethers } from 'ethers'
import ERC721Template from '@oceanprotocol/contracts/artifacts/contracts/templates/ERC721Template.sol/ERC721Template.json'
import { generateDtName, sendTx, getEventFromTx, ZERO_ADDRESS } from '../utils'
import {
MetadataProof,
File FixedRateExchange.ts
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
import FixedRateExchangeAbi from '@oceanprotocol/contracts/artifacts/contracts/pools/fixedRate/FixedRateExchange.sol/FixedRateExchange.json'
import { sendTx, ZERO_ADDRESS } from '../utils'
import {
PriceAndFees,
FeesInfo,
Function orderAsset
has 181 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function orderAsset(
asset: Asset,
consumerAccount: Signer,
config: Config,
datatoken: Datatoken,
Function orderAsset
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
export async function orderAsset(
asset: Asset,
consumerAccount: Signer,
config: Config,
datatoken: Datatoken,
- 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 NFTFactory.ts
has 439 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { BigNumber, ethers } from 'ethers'
import ERC721Factory from '@oceanprotocol/contracts/artifacts/contracts/ERC721Factory.sol/ERC721Factory.json'
import {
generateDtName,
ZERO_ADDRESS,
Function createAsset
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function createAsset(
name: string,
symbol: string,
owner: Signer,
assetUrl: any, // files object
Datatoken
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
export class Datatoken extends SmartContract {
public abiEnterprise: AbiItem[]
public nft: Nft
getDefaultAbi() {
Function sendTx
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
export async function sendTx(
estGas: BigNumber,
signer: Signer,
gasFeeMultiplier: number,
functionToSend: ContractFunction,
- 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
FixedRateExchange
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
export class FixedRateExchange extends SmartContractWithAddress {
getDefaultAbi() {
return FixedRateExchangeAbi.abi as AbiItem[]
}
File ConfigHelper.ts
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
// eslint-disable-next-line import/no-named-default
import { default as DefaultContractsAddresses } from '@oceanprotocol/contracts/addresses/address.json'
import fs from 'fs'
import { Config } from '.'
import { LoggerInstance } from '../utils'
Function getAddressesFromEnv
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config> {
// use the defaults first
let configAddresses: Partial<Config>
// load from custom addresses structure
if (customAddresses && customAddresses[network]) {
Nft
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class Nft extends SmartContract {
getDefaultAbi() {
return ERC721Template.abi as AbiItem[]
}
Function createAsset
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export async function createAsset(
name: string,
symbol: string,
owner: Signer,
assetUrl: any, // files object
- 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
NftFactory
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
export class NftFactory extends SmartContractWithAddress {
getDefaultAbi() {
return ERC721Factory.abi as AbiItem[]
}
Function createDatatoken
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async createDatatoken<G extends boolean = false>(
nftAddress: string,
address: string,
minter: string,
paymentCollector: string,
Provider
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class Provider {
/**
* Returns the provider endpoints
* @param {string} providerUri - the provider url
* @return {Promise<any>}
Function computeStart
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async computeStart(
providerUri: string,
consumer: Signer,
computeEnv: string,
dataset: ComputeAsset,
File Assets.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { SHA256 } from 'crypto-js'
import { ethers, Signer } from 'ethers'
import { ConfigHelper } from '../../src/config'
import { hexlify } from 'ethers/lib/utils'
import { createHash } from 'crypto'