Showing 46 of 833 total issues
File ContractInterfaces.ts
has 5358 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// THIS FILE IS AUTOMATICALLY GENERATED BY `generateContractInterfaces.ts`. DO NOT EDIT BY HAND'
import BN = require('bn.js');
import { encodeMethod, decodeParams } from 'ethjs-abi';
import { AbiFunction } from 'ethereum';
Augur
has 92 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Augur extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
Universe
has 91 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Universe extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
Market
has 64 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Market extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
TestNetReputationToken
has 58 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class TestNetReputationToken extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
ReputationToken
has 56 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class ReputationToken extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
FeeWindow
has 52 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class FeeWindow extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
DisputeCrowdsourcer
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class DisputeCrowdsourcer extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
TestFixture
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class TestFixture {
private static GAS_PRICE: BN = new BN(1);
private readonly connector: Connector;
public readonly accountManager: AccountManager;
InitialReporter
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class InitialReporter extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
ShareToken
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class ShareToken extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
Orders
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Orders extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
Cash
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Cash extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
File ContractDeployer.ts
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import BN = require('bn.js');
import { hash } from 'crypto-promise';
import { exists, readFile, writeFile } from "async-file";
import { exec } from 'child_process';
import { encodeParams } from 'ethjs-abi';
ContractDeployer
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class ContractDeployer {
private readonly accountManager: AccountManager;
private readonly configuration: DeployerConfiguration;
private readonly connector: Connector;
private readonly contracts: Contracts;
FeeToken
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class FeeToken extends Controlled {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
LegacyReputationToken
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class LegacyReputationToken extends Contract {
public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
super(connector, accountManager, address, defaultGasPrice);
}
Function filterCompilerOutput
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
private filterCompilerOutput(compilerOutput: CompilerOutput): CompilerOutput {
const result: CompilerOutput = { contracts: {} };
for (let relativeFilePath in compilerOutput.contracts) {
for (let contractName in compilerOutput.contracts[relativeFilePath]) {
// don't include libraries
- 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 upload
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
private async upload(contract: Contract): Promise<void> {
const contractsToDelegate: {[key:string]: boolean} = {"Orders": true, "TradingEscapeHatch": true, "Cash": true};
const contractName = contract.contractName
if (contractName === 'Controller') return;
if (contractName === 'Delegator') return;
- 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 proceedToNextRound
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async proceedToNextRound(fixture: TestFixture, market: Market, doGenerateFees: boolean = false, moveTimeForward: boolean = true, randomPayoutNumerators: boolean = false) {
const currentTimestamp = await fixture.getTimestamp();
const marketEndTime = await market.getEndTime_();
if (currentTimestamp.lt(marketEndTime)) {
const marketDesignatedReportingEndTime = await market.getDesignatedReportingEndTime_();