AugurProject/augur-core

View on GitHub

Showing 46 of 833 total issues

File ContractInterfaces.ts has 5358 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Major
Found in source/libraries/ContractInterfaces.ts - About 2 wks to fix

    Augur has 92 functions (exceeds 20 allowed). Consider refactoring.
    Open

        export class Augur extends Controlled {
            public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                super(connector, accountManager, address, defaultGasPrice);
            }
    
    
    Severity: Major
    Found in source/libraries/ContractInterfaces.ts - About 1 day to fix

      Universe has 91 functions (exceeds 20 allowed). Consider refactoring.
      Open

          export class Universe extends Controlled {
              public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                  super(connector, accountManager, address, defaultGasPrice);
              }
      
      
      Severity: Major
      Found in source/libraries/ContractInterfaces.ts - About 1 day to fix

        Market has 64 functions (exceeds 20 allowed). Consider refactoring.
        Open

            export class Market extends Controlled {
                public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                    super(connector, accountManager, address, defaultGasPrice);
                }
        
        
        Severity: Major
        Found in source/libraries/ContractInterfaces.ts - About 1 day to fix

          TestNetReputationToken has 58 functions (exceeds 20 allowed). Consider refactoring.
          Open

              export class TestNetReputationToken extends Controlled {
                  public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                      super(connector, accountManager, address, defaultGasPrice);
                  }
          
          
          Severity: Major
          Found in source/libraries/ContractInterfaces.ts - About 1 day to fix

            ReputationToken has 56 functions (exceeds 20 allowed). Consider refactoring.
            Open

                export class ReputationToken extends Controlled {
                    public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                        super(connector, accountManager, address, defaultGasPrice);
                    }
            
            
            Severity: Major
            Found in source/libraries/ContractInterfaces.ts - About 1 day to fix

              FeeWindow has 52 functions (exceeds 20 allowed). Consider refactoring.
              Open

                  export class FeeWindow extends Controlled {
                      public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                          super(connector, accountManager, address, defaultGasPrice);
                      }
              
              
              Severity: Major
              Found in source/libraries/ContractInterfaces.ts - About 7 hrs to fix

                DisputeCrowdsourcer has 43 functions (exceeds 20 allowed). Consider refactoring.
                Open

                    export class DisputeCrowdsourcer extends Controlled {
                        public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                            super(connector, accountManager, address, defaultGasPrice);
                        }
                
                
                Severity: Minor
                Found in source/libraries/ContractInterfaces.ts - About 5 hrs to fix

                  TestFixture has 41 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export class TestFixture {
                      private static GAS_PRICE: BN = new BN(1);
                  
                      private readonly connector: Connector;
                      public readonly accountManager: AccountManager;
                  Severity: Minor
                  Found in source/tests-integration/TestFixture.ts - About 5 hrs to fix

                    InitialReporter has 40 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                        export class InitialReporter extends Controlled {
                            public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                super(connector, accountManager, address, defaultGasPrice);
                            }
                    
                    
                    Severity: Minor
                    Found in source/libraries/ContractInterfaces.ts - About 5 hrs to fix

                      ShareToken has 38 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                          export class ShareToken extends Controlled {
                              public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                  super(connector, accountManager, address, defaultGasPrice);
                              }
                      
                      
                      Severity: Minor
                      Found in source/libraries/ContractInterfaces.ts - About 5 hrs to fix

                        Orders has 37 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                            export class Orders extends Controlled {
                                public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                    super(connector, accountManager, address, defaultGasPrice);
                                }
                        
                        
                        Severity: Minor
                        Found in source/libraries/ContractInterfaces.ts - About 4 hrs to fix

                          Cash has 33 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                              export class Cash extends Controlled {
                                  public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                      super(connector, accountManager, address, defaultGasPrice);
                                  }
                          
                          
                          Severity: Minor
                          Found in source/libraries/ContractInterfaces.ts - About 4 hrs to fix

                            File ContractDeployer.ts has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                            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';
                            Severity: Minor
                            Found in source/libraries/ContractDeployer.ts - About 3 hrs to fix

                              ContractDeployer has 31 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class ContractDeployer {
                                  private readonly accountManager: AccountManager;
                                  private readonly configuration: DeployerConfiguration;
                                  private readonly connector: Connector;
                                  private readonly contracts: Contracts;
                              Severity: Minor
                              Found in source/libraries/ContractDeployer.ts - About 3 hrs to fix

                                FeeToken has 30 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                    export class FeeToken extends Controlled {
                                        public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                            super(connector, accountManager, address, defaultGasPrice);
                                        }
                                
                                
                                Severity: Minor
                                Found in source/libraries/ContractInterfaces.ts - About 3 hrs to fix

                                  LegacyReputationToken has 28 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                      export class LegacyReputationToken extends Contract {
                                          public constructor(connector: Connector, accountManager: AccountManager, address: string, defaultGasPrice: BN) {
                                              super(connector, accountManager, address, defaultGasPrice);
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in source/libraries/ContractInterfaces.ts - About 3 hrs to fix

                                    Function filterCompilerOutput has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                                    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
                                    Severity: Minor
                                    Found in source/libraries/ContractCompiler.ts - About 3 hrs to fix

                                    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

                                        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;
                                    Severity: Minor
                                    Found in source/libraries/ContractDeployer.ts - About 2 hrs to fix

                                    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

                                        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_();
                                    Severity: Major
                                    Found in source/tests-integration/ReportingUtils.ts - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language