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
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
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'
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 calculateActiveTemplateIndex
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function calculateActiveTemplateIndex(
owner: Signer,
nftContractAddress: string, // addresses.ERC721Factory,
template: string | number
): Promise<number> {
- 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 getOceanArtifactsAdressesByChainId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getOceanArtifactsAdressesByChainId(chain: number): any {
try {
// eslint-disable-next-line security/detect-non-literal-fs-filename
const data = getOceanArtifactsAdresses()
if (data) {
- 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"