Function contractInterfacesTemplate
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private contractInterfacesTemplate(contracts: CompilerOutputContracts) {
const contractInterfaces: Array<string> = [];
// We add Controlled first to let other contracts inherit from it
contractInterfaces.push(this.contractInterfaceTemplate("Controlled", contracts["Controlled.sol"]["Controlled"].abi));
Function getTsTypeFromPrimitive
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getTsTypeFromPrimitive(abiType: Primitive) {
switch(abiType) {
case 'uint8':
case 'uint64':
case 'uint256':
Function contractInterfacesTemplate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private contractInterfacesTemplate(contracts: CompilerOutputContracts) {
const contractInterfaces: Array<string> = [];
// We add Controlled first to let other contracts inherit from it
contractInterfaces.push(this.contractInterfaceTemplate("Controlled", contracts["Controlled.sol"]["Controlled"].abi));
- 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 localMethodTemplate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private localMethodTemplate(abiFunction: AbiFunction) {
const argNames: String = this.getArgNamesString(abiFunction);
const params: String = this.getParamsString(abiFunction);
const options: String = `{ sender?: string${abiFunction.payable ? ", attachedEth?: BN" : ""} }`;
const returnType: String = (abiFunction.outputs[0] !== undefined) ? this.getTsTypeFromPrimitive(abiFunction.outputs[0].type) : "void";
- 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 contractInterfaceTemplate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private contractInterfaceTemplate(contractName: String, contractAbi: Abi) {
const contractMethods: Array<String> = [];
// Typescript doesn't allow the same name for a function. We only have one existing case for function overloading in a class and it has the same signature, so this is ok at the moment.
const seen: Set<string> = new Set();
- 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
Avoid too many return
statements within this function. Open
return 'Array<string>';
Avoid too many return
statements within this function. Open
return 'Array<BN>';